loop FOR to group discrete signals
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi every one;
with this simply code:
for i=1:5
a=2*i;
b=[];
b=[b;a];
end
i have: >> b=10;
i want to modify the code to have in the result:
>> b=[2;4;6;8;10];
can u help me, it's importante for me, to generalize 't with my programme.
thank's.
0 Kommentare
Antworten (1)
Star Strider
am 20 Jun. 2015
Just put your ‘b’ initilisation before the loop:
b=[];
for i=1:5
a=2*i;
b=[b;a];
end
2 Kommentare
Star Strider
am 21 Jun. 2015
My pleasure!
I would of course appreciate it if you would Accept my Answer.
Siehe auch
Kategorien
Mehr zu Startup and Shutdown 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!