How do I perform prelocation when creating an array using a for loop?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
sefa arslan
il 14 Giu 2021
Commentato: sefa arslan
il 14 Giu 2021
for example
Vcruise=[];
HPreq=[];
speedvalue=160;
for i=1:1:speedvalue
Vcruise=[Vcruise,i];
........
Ptotal_fwd=....
......
HPreq=[HPreq,PTotal_fwd];
end
and some graphical operations
0 Commenti
Risposta accettata
David Hill
il 14 Giu 2021
speedvalue=160;
Vcruise=zeros(1,speedvalue);
HPreq=zeros(1,speedvalue);
for i=1:1:speedvalue
Vcruise(i)=i;
Ptotal_fwd=....
Preq(i)=PTotal_fwd;
end
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices 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!