How can I use inputdlg() to store multiple variables and then use those variables in equations for later?

조회 수: 2 (최근 30일)
Variables = inputdlg(["m","b","k","x1","x2","F","w0"])
Values = str2double(Variables{:})
l = b/2
w = sqrt(k/m)
wc=sqrt(w^2-l^2)
r1=-l+sqrt(l^2-w^2)
r2=-l-sqrt(l^2-w^2)

채택된 답변

Stephen23
Stephen23 2021년 4월 28일
편집: Stephen23 2021년 4월 28일
>> C = inputdlg(["m","b","k","x1","x2","F","w0"])
C =
7×1 cell array
{'1.2'}
{'2.3'}
{'3.4'}
{'4.5'}
{'5.6'}
{'6.7'}
{'7.8'}
>> C = num2cell(str2double(C));
>> [m,b,k,x1,x2,F,w0] = deal(C{:})
m =
1.2000
b =
2.3000
k =
3.4000
x1 =
4.5000
x2 =
5.6000
F =
6.7000
w0 =
7.8000
>>

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by