for loop problem with matrix

1 visualización (últimos 30 días)
Rica
Rica el 22 de Mayo de 2013
Hi all!
I have matrix 'Input' with the size of 1024*10
i wrote a matlab program just for one vector input(:,1). the programm is:
n1=1024
xx=reshape(Input(:,1),4,n1/4);
x_r=[xx(1,1:n1/4);-xx(3,1:n1/4)];
x_i=[xx(2,1:n1/4);-xx(4,1:n1/4)];
x_rr=reshape(x_r,1,n1/2);
x_ii=reshape(x_i,1,n1/2);
how could i do the same for alle other 9 vectors, possibly without for loop?

Respuesta aceptada

Iain
Iain el 22 de Mayo de 2013
You could do it by using the THIRD dimension.
xx = reshape(Input,[4,nl/4,10]);
x_r = [xx(1,:,:);-xx(3,:,:)];
x_l = [xx(2,:,:);-xx(4,:,:)];
x_rr = reshape(x_r,[1,nl/2,10]);
... etc.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by