GUI handles problem... throughout code it vanishes!?
Mostrar comentarios más antiguos
Hello,
I'm making GUI throught GUIDE and have a little problem in my code.
I'm using handles to pass variables between callback functions. The problem is two handles which I store in edit text fields. After storing to workspace I've filled handles like..
handles.LAIi=LAIi (% my variable)
at the end of callback fnc of editfield I did check existence of LAI=XXX in handles.
...
mer_data: [436x24 double] % CHECK AFTER editbox CALLBACK
FileName_data: '0_VRT_DOMANIN_110211.xls'
LAIi: 16
But later in code in other function I'need to use that value. So i call it by handles.LAIi
rs=1/((gl*0.002/0.08)*((handles.LAIi)/2));
handles.rs=rs;
assignin('base','rs',rs);
Matlab halts with error
mer_data: [436x24 double] % THIS IS CHECK before that equation
FileName_data: '0_VRT_DOMANIN_110211.xls'
T_z: [436x1 double] % AND THE LAIi is GONE!! :\
T_zp: [436x1 double]
L: [436x1 double]
Ez: [436x1 double]
Ezp: [436x1 double]
Rh_z: [436x1 double]
ez: [436x1 double]
Rh_zp: [436x1 double]
ezp: [436x1 double]
gl: 0.2000
??? Reference to non-existent field 'LAIi'.
Error in ==> GUI>vypocti_Callback at 286
rs=1/((gl*0.002/0.08)*((handles.LAIi)/2)); %
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> GUI at 39
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)GUI('vypocti_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
HELP PLEASE.. POST your advices! Need that to be done :\ and I cannot see where's problem since i'm using variable mer_data same way with no problem...
Respuesta aceptada
Más respuestas (1)
Paulo Silva
el 13 de Jun. de 2011
When you do
handles.LAIi=LAIi;
you must also update the handles structure
guidata(hObject, handles);
1 comentario
Lex
el 13 de Jun. de 2011
Categorías
Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!