双击弹出式菜单,会弹出一个小窗口。在窗口中找到string属性,可以根据需要进行修改。本例中,将属性值改为"x, sin(x), cos(x)",以绘制这三个函数的图像。接着,打开GUI的m文件,找到函数"popupmenu1_Callback(hObject, eventdata, handles)"。在该函数的代码中,添加如下所示的代码片段。修改完...
function popupmenu1_Callback(hObject, eventdata, handles) % hObject handle to popupmenu1 (see GCBO) % eventdata reserved - to be definedina future version of MATLAB % handles structure with handles and user data (see GUIDATA) val=get(handles.popupmenu1,'Value')%不加分号,将结果显示 选择不...
function popupmenu1_Callback(hObject, eventdata, handles)hObject handle to popupmenu1 (see GCBO)eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)global Selec;Selec = get(hObject,'Value');function pus...
打开这个POPUPMENU的Callback函数,在下面写这样的代码:val=get(handles.popupmenu1,'value'); %假定这个下拉菜单的TAG是popupmenu1 switch val case '1' %假定你把'打开图片'放在下拉菜单的最上面 [filename fileadress]=uigetfile('*jpg');case '2' %下面还有几个选项 ...end 这样...
1 step1 打开GUI首先在Matlab软件中打开需要新加弹出式菜单控件的GUI;如果没有GUI,则按照引导首先新建空白gui 2 step2 选中弹出式菜单控件进入空白gui后,首先在控件列表中选中弹出式菜单控件 3 step3 放置控件在画布区放置弹出式菜单控件,并根据设计需要调整控件的大小 4 step4 添加下拉菜单双击控件弹出属性设置,...
'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); ...
function popupmenu1_Callback(hObject, eventdata, handles) % hObject handle to popupmenu1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns popupmenu...
function turn_up_Callback(hObject, eventdata, handles) % hObject handle to turn_up (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on selection change in popupmenu1. ...
gui_State.gui_Callback=str2func(varargin{1}); end ifnargout [varargout{1:nargout}]=gui_mainfcn(gui_State,varargin{:}); else gui_mainfcn(gui_State,varargin{:}); end %Endinitializationcode-DONOTEDIT %---Executesjustbeforewavlet_package_energy_GUIismadevisible. ...
5 5、修改之后,打开GUI的m文件,找到function popupmenu1_Callback(hObject, eventdata, handles)在它下面添加如图所示代码 6 6、代码添加后保存,然后退出m文件,点击GUI界面工具栏最后一个绿色三角形,也就是运行按钮,将会出现如图界面,选择想要绘制的函数,点击后将会在坐标轴绘制图像 ...