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 Center および File ExchangeOceanography and Hydrology についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by