GUIDEで作成したGUIからポップアップメニューを作成しようとしています。私は次のようにしています:
TestFiles = dir([pwd '/test/*.txt']);
TestList = [];
for i = 1:length(TestFiles)
filename = TestFiles(i).name;
TestList = [TestList filename];
end
set(handles.popup_test,'string',TestList);
私はこれをpopup_test_CreateFcn
メソッド内で行っています(ただし、それが正しい場所かどうかはわかりません)。
GUIを起動しようとすると、次のようになります。
??? Attempt to reference field of non-structure array.
Error in ==> init>popup_test_CreateFcn at 101
set(handles.popup_test,'string',TestList);
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> init at 19
gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)init('popup_test_CreateFcn',hObject,eventdata,guidata(hObject))
??? Error using ==> struct2handle
Error while evaluating uicontrol CreateFcn
そのため、何らかの理由で、このset()
メソッドではポップアップメニューにTestListを入力できません。
何かご意見は?
前もって感謝します。