フィルターのクリア

Some problem in taking values from particular text file

1 回表示 (過去 30 日間)
RS
RS 2013 年 8 月 24 日
I have a matrix A 965*365 want to make from this matrix a matrix Z such that it is having only three rows such that in 1st row value of A(:,1), A(:,4), A(:,7) and so on and in second row value of A(:,2), A(:,5) and so on and in third row value of A(:,3), A(:,6) and so on
Z=[];n=1;
for i=1:4:3864
Z(n:n+965,1)=A(:,i+2);
Z(n:n+965,2)=A(:,i+3);
Z(n:n+965,3)=A(:,i);
n=n+965;
end
Subscripted assignment dimension mismatch.
Plz tell me how can I solve it?

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 24 日
A1=A(:,1:3:end);
A2=A(:,2:3:end);
A3=A(:,3:3:end);
out=[A1(:) A2(:) A3(:)]'
  1 件のコメント
Image Analyst
Image Analyst 2013 年 8 月 24 日
Because Azzi wrote code for exactly what you said, but you are not saying what you want. Please describe what you want accurately next time.

サインインしてコメントする。

その他の回答 (1 件)

per isakson
per isakson 2013 年 8 月 24 日
編集済み: per isakson 2013 年 8 月 24 日
Is this what you intended?
function Z = cssm
A = randi( 12, [965,365] );
Z=[];
n=1;
N_end = 964;
for i=1:4:364
Z(n:n+N_end,1)=A(:,i+2);
Z(n:n+N_end,2)=A(:,i+3);
Z(n:n+N_end,3)=A(:,i);
n=n+N_end + 1;
end
end
Anyhow, it returns a result.
.
Here are some links on debugging in Matlab

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by