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

1 Ansicht (letzte 30 Tage)
Ali
Ali am 24 Nov. 2022
Beantwortet: Walter Roberson am 24 Nov. 2022
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.

Antworten (1)

Walter Roberson
Walter Roberson am 24 Nov. 2022
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

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Produkte


Version

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by