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?
0 个评论
采纳的回答
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
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Platform and License 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!