马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
<P>各位好!我想请教大家一个问题:我用matlab的GUI设计工具设计了一个界面,界面是一个listbox控件,控件里面有8项,每次用户选中某一项时会弹出相应的新窗口,以下是我编写的listbox控件的callback例程代码:<BR><BR>function listbox1_Callback(hObject, eventdata, handles)<BR>% hObject handle to listbox1 (see GCBO)<BR>% eventdata reserved - to be defined in a future version of MATLAB<BR>% handles structure with handles and user data (see GUIDATA)</P>
<P>% Hints: contents = get(hObject,'String') returns listbox1 contents as cell array<BR>% contents{get(hObject,'Value')} returns selected item from listbox1<BR>index=get(handles.listbox1,'value');<BR>switch index<BR> case 1<BR> openfig('xxbxlsbcs','reuse');<BR> case 2<BR> openfig('fcbxlsbcs','reuse');<BR> case 3<BR> openfig('gcbxlsbcs','reuse');<BR> case 4<BR> openfig('sbtbxlsbcs','reuse');<BR> case '5<BR> openfig('sblbxlsbcs','reuse');<BR> case 6<BR> openfig('gpbxlsbcs','reuse');<BR> case 7<BR> openfig('mlbxlsbcs','reuse');<BR> case 8<BR> openfig('jsbxlsbcs','reuse');<BR>end<BR> 但是我每次在控件中选中某一项时,matlab窗口就显示以下错误代码:<BR><BR>??? Attempt to reference field of non-structure array.</P>
<P>Error in ==> sbcssr>listbox1_Callback at 86<BR>index=get(handles.listbox1,'value');</P>
<P>Error in ==> gui_mainfcn at 75<BR> feval(varargin{:});</P>
<P>Error in ==> sbcssr at 44<BR> gui_mainfcn(gui_State, varargin{:});</P>
<P>??? Error while evaluating uicontrol Callback.<BR><BR>请高手们帮指导一下我的编程出了什么问题,不胜感激!</P> |