フィルターのクリア

how do i now use the user provided data?

1 回表示 (過去 30 日間)
buxZED
buxZED 2011 年 2 月 24 日
clear
clc
stu_id=0.2529;
prompt = {'Gravity (g):','Angle (a):','iv (V0):'};
dlg_title = 'Enter the values for';
num_lines = 1;
def = {'9.81','35','25.820880000000002'};
answer = inputdlg(prompt,dlg_title,num_lines,def);
how do i now use the user provided data? imagine if i want to display the F = Gravity (g) * Angle (a)

採用された回答

Paulo Silva
Paulo Silva 2011 年 2 月 24 日
clear
clc
stu_id=0.2529;
prompt = {'Gravity (g):','Angle (a):','iv (V0):'};
dlg_title = 'Enter the values for';
num_lines = 1;
def = {'9.81','35','25.820880000000002'};
answer = inputdlg(prompt,dlg_title,num_lines,def);
if (~isempty(answer))
answer=str2double(answer);
Gravity=answer(1);
Angle=answer(2);
iv=answer(3);
F=Gravity*Angle %answer(1)*answer(2) %would also work
else
error('Canceled by user')
end

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2011 年 2 月 24 日
Details are given in the Remarks section of the inputdlg reference

カテゴリ

Help Center および File ExchangeExternal Language Interfaces についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by