GUI Edit Boxes and recalling values.

1 次查看(过去 30 天)
Doug
Doug 2012-12-1
Hi there,
I have just started to make a GUI for a Shooting method projectile problem.
I have 2 input angles and a error specified by the user. I have 3 edit boxes where I input the data for the three values (theta1, theta2, reqe). Please see code below.
function theta2_Callback(hObject, eventdata, handles)
% hObject handle to theta2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of theta2 as text
% str2double(get(hObject,'String')) returns contents of theta2 as a double
theta2 = str2double(get(hObject,'string'));
if isnan(theta2)
errordlg('You must enter a numeric value','Bad Input','modal')
uicontrol(hObject)
return
end
same thing for theta 1 and reqe.
Then I have a push button where I want to run my function file called 'Shooter'
But I can't seem to do it. Also i cannot carry forward the variables from the previous functions. The Shooter function needs all 3 values to run.
Shooter(theta1, theta2, reqe);
This m file then calculates everything I need.
Many thanks.

回答(1 个)

Walter Roberson
Walter Roberson 2012-12-1
  2 个评论
Doug
Doug 2012-12-1
Thank you for your reply. Unfortunately I didn't really understand what is was trying to get across.
Doug
Doug 2012-12-1
It's ok I figured it out using the handle method. Thanks

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Oceanography and Hydrology 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by