MATLAB: 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

guiwindows

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

Best Answer

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.
Related Question