how can i get in place of %d is i values for each iteration of e
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ganesh budi
am 12 Jun. 2018
Beantwortet: Ganesh budi
am 13 Jun. 2018
num_nod=input('num_nod = ')
for e=1:2*num_nod
force(e,1)=input('applied forces at node %d:',e);
end
0 Kommentare
Akzeptierte Antwort
Geoff Hayes
am 12 Jun. 2018
force(e,1) = input(sprintf('applied forces at node %d:',e));
Also, pre-allocate memory to the force array so that it doesn't need to increase size on each iteration of the loop. i.e.
num_nod=input('num_nod = ')
force = zeros(2*num_nod,1);
for e=1:2*num_nod
force(e,1) = input(sprintf('applied forces at node %d:',e));
end
0 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Linear Algebra finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!