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