Reference to non-existent field when opening gui with toolbar icone

1 次查看(过去 30 天)
Hello i have a gui that i can open thought the open folder icone in the toolbar and when i do it this way i have the following error
Error using kgexec4 (line 463)
Error evaluating 'OpenFcn' callback of ParamNor block (mask)
'Model_ACWA_1/paramètres de norme'.
Caused by:
Error using kgexec4 (line 463)
Reference to non-existent field 'X'.
Error while evaluating uipushtool ClickedCallback
the problem comes from the gui file where the pushbutton is used because :
%bouton OK
handles.button = uicontrol(h0,'Style','pushbutton',...
'BackgroundColor',gris,...
'Position',[27 0.5 16 2],...
'String','OK',...
'Tag','NormeOK',...
'Callback',@buttonCB);
guidata(h0,handles);
handles.X=0;
.
.
.
function buttonCB(ButtonH, EventData)
handles = guidata(ButtonH);
handles.X = 1;
guidata(ButtonH, handles);
end
end
when the handles.X=0 is usualy above the handles.button but when it is and i open the gui with the icone in the toolbar all the gui callbacks won't works but when it's in this position only the callback to the function buttonCB won't work if anyone can help.

回答(1 个)

Walter Roberson
Walter Roberson 2022-11-24
If you have created a gui using GUIDE then you must run the m file not open the fig file. The handles structure does not get created unless you run the m file

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

产品


版本

R2014a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by