Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
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)

Réponse acceptée

Stephen23
Stephen23 le 28 Avr 2021
Modifié(e) : Stephen23 le 28 Avr 2021
>> 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
>>

Plus de réponses (0)

Catégories

En savoir plus sur Simulink dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by