GUI中出现Attempt to reference field of non-structure array.这个错误

在调试运行的时候没有错误
但是再current directory中直接双击运行的时候就出现这个问题

错误提示如下:(总之是这一类的)
Attempt to reference field of non-structure array.
Error in ==> zitongbu_gui>pn_listbox_Callback at 373
set(handles.PNGeneratorEdit,'string',str);

解决方法:

貌似handles没有更新变量。前面加了两句这个就好了:
handles=guihandles;
guidata(hObject,handles);

亲测好使,至少在设置colormap时好使。

参考自:http://www.ilovematlab.cn/thread-163662-1-1.html

原文地址:https://www.cnblogs.com/Dontstop/p/5381736.html