GUI will run when I hit the green arrow "Run" in the .m or GUIDE, but gives error when double clicking to run on Windows Explorer
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Anthony
am 18 Jun. 2015
Beantwortet: Image Analyst
am 18 Jun. 2015
Hi guys,
I've been working on a GUI for a few days, everything is working when I hit the green "Run" button on the .m or the green run button on the GUIDE, but if I double click from windows explorer, it gives me this error every time:
Attempt to reference field of non-structure array.
Error in importGUI>addSelected_Callback (line 118) entries = cellstr(get(handles.channelList,'String'));
Error in gui_mainfcn (line 95) feval(varargin{:});
Error in importGUI (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)importGUI('addSelected_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback
I made sure everything is saved. If anyone knows how to fix this I'd appreciate it!
Thanks
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 18 Jun. 2015
You cannot double-click on the .fig to have the GUI run; you have to run the .m file. The .fig does not have some of the necessary initialization that the .m file has.
0 Kommentare
Weitere Antworten (1)
Image Analyst
am 18 Jun. 2015
For me, double-clicking on the m-file icon in Windows Explorer launches MATLAB (if it's not already open) and opens an editor window with the file I clicked on. It does not automatically run the file though. I'm not sure why you're seeing it run automatically and instantly upon starting MATLAB. It should not run it - it should wait for you to type F5 or click the green Run triangle button. Even if it did run your m-file immediately it should not give any errors different than if you manually had started your m-file in the MATLAB development environment.
Are you absolutely 100% sure that it was the m-file you clicked on? You should tell Windows Explorer not to hide extensions - that's an annoying feature it borrowed from Macs to dumb down the interface and which let you have several icons in the folder, hopefully with different icons but sometimes not, that have the same name, and you don't always know what file is what icon. Fortunately you can tell it to display file extensions. You might call tech support if you still have trouble launching the m file.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!