loop FOR to group discrete signals

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.

Respuestas (1)

Star Strider
Star Strider el 20 de Jun. de 2015
Just put your ‘b’ initilisation before the loop:
b=[];
for i=1:5
a=2*i;
b=[b;a];
end

2 comentarios

studentU
studentU el 20 de Jun. de 2015
oh! yes, okey; thank's for ure repply
Star Strider
Star Strider el 21 de Jun. de 2015
My pleasure!
I would of course appreciate it if you would Accept my Answer.

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Preguntada:

el 20 de Jun. de 2015

Comentada:

el 21 de Jun. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by