GUI Edit Boxes and recalling values.

1 view (last 30 days)
Doug
Doug on 1 Dec 2012
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.

Answers (1)

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

Sign in to comment.

Categories

Find more on Oceanography and Hydrology in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!