matlab gui设计

来源:百度知道 编辑:UC知道 时间:2024/06/27 03:23:45
运行gui的时候会在命令窗口出现下面的错误:但是gui功能能基本实现求高人指点
??? Error using ==> feval
Undefined function or method 'popupmenu1_CreateFcn' for input arguments of type 'double'.

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> untitled1 at 42
gui_mainfcn(gui_State, varargin{:});

??? Error using ==> struct2handle
Error while evaluating uicontrol CreateFcn

有可能是你不小心把
function popupmenu1_CreateFcn(hObject, eventdata, handles)
这样的行给删掉了。
这个子函数是菜单建立时调用的

matlab本身带的那个例子,这个子函数是类似这样的
% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

set(hObject, 'String', {'plot(rand(5))', 'plot(sin(1:0.01:25))', 'comet(cos(1:.01:10))', 'bar(1:10)', 'plot(membrane)', 'surf(peaks)&