フィルターのクリア

GUI Error Message in the use of a push button and it is NOT the addition of 'guidata(hObject, handles);' that is missing

1 回表示 (過去 30 日間)
These are all of the input values for my GUI which are being converted into numbers.
rmin=str2num(get(handles.inputrmin,'String'));
thetamin=str2num(get(handles.inputthetamin,'String'));
thetamax=str2num(get(handles.inputthetamax,'String'));
BOC=str2num(get(handles.inputBOC,'String'));
OC=str2num(get(handles.inputOC,'String'));
m=str2num(get(handles.inputm,'String'));
rmax=str2num(get(handles.inputrmax,'String'));
A function is then used which calculates outputs below
opt_a, opt_b, Fmin/1000, opt_phi
These are then converted back to strings
a1=num2str(opt_a);
b1=num2str(opt_b);
Fmin1=num2str(Fmin/1000);
phi1=num2str(opt_phi);
phi1D=rad2deg(phi1);
set(handles.outputopt_a,'String',a1);
set(handles.outputopt_b,'String',b1);
set(handles.outputOptimum_Force_KN,'String',Fmin1);
set(handles.outputopt_phi,'String',phi1D);
guidata(hObject, handles);
I am getting the following error message
??? Reference to non-existent field 'outputopt_a'.
Error in ==> GUI>calculate_Callback at 371
set(handles.outputopt_a,'String',a1);
I have checked the GUI static text box which is to recieve the output and the tag is 'outputopt_a' so there is no difference here. Any idea where i have gone wrong?

採用された回答

karan
karan 2011 年 11 月 25 日
check calculation for opt_a...can u post the function
if opt_a is computed in a different function u need to store it in that function and get the same data to this new function where u give commands for set
  2 件のコメント
karan
karan 2011 年 11 月 25 日
do
handles.set_my_field = opt_a
in function where u computed
do a guidata(hObject, handles); at the end of the same function
by this you are saving the handles such that it can be used by other functions later.
no w in the function where u give commands to set your values
opt_a = handles.set_my_field
this would give u access back to the same values of opt_a in the other function where u desire it to be
David Fraser
David Fraser 2011 年 11 月 25 日
Thanks for your quick response but after a bit of tweaking (not exactly sure what) its running fine :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by