for loop problem with matrix
1 回表示 (過去 30 日間)
古いコメントを表示
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?
0 件のコメント
採用された回答
Iain
2013 年 5 月 22 日
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.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!