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

조회 수: 1 (최근 30일)
Ali
Ali 2022년 11월 24일
답변: Walter Roberson 2022년 11월 24일
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