Hi in the following script if my value pass through my switch func I want to change its value in my array called name(1,i) by the new value created and can't find how.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Simon Lacourse
il 23 Giu 2020
Commentato: Simon Lacourse
il 25 Giu 2020
Nlayer = input('enter the number of layers :');
airin = 8.3; %Hc
gypse = 12.5; %C
air = 0.025; %k
conblock = 5; %C
wool = 0.0499; %k
brick = 0.72; %k
airout = 34; %Hc
for i = 1:Nlayer;
name(1,i) = input('enter the name of the layers in order, inside to outside :');
switch name(1,i);
case air;
L_air = input(' enter the thickness in mm :');
air = air/L_air
case brick;
L_brick = input(' enter the thickness in mm :');
brick = brick/L_brick
case wool;
L_wool = input(' enter the thickness in mm :');
wool = wool/L_wool
end
end
0 Commenti
Risposta accettata
Sai Sri Harsha Vallabhuni
il 25 Giu 2020
Hey,
What do you mean when you say "change its value in name array"?
I'm assuming you want to take the updated values of air, brick etc... into the name array and that is as direct as assigning to name(1, i).
air = air/L_air;
name(1, i) = air;
And it is good practice to allocate space to name array as you already know the size(Nlayer) to which it will grow later.
name = zeros(1, Nlayer);
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Statics and Dynamics in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!