フィルターのクリア

New line inside for loop

1 回表示 (過去 30 日間)
Baba
Baba 2011 年 10 月 31 日
Hi, I have a large matrix, and what I want to do is pick out first 3 elements of each row, transpose and stack on top of each other, so just have one column at the end...
for example: if i start with this matrix:
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
I want to end up with this column:
1
2
3
6
7
8
11
12
13
My problem is: how do I put the pointer on a new line at the end of for loop?
test=load('test.txt');
for i=1:length(test(:,1))
HX1=test(i:i,1:3)'
\n <------ this is not working ....
end

採用された回答

Walter Roberson
Walter Roberson 2011 年 10 月 31 日
reshape(test(:,1:3).',[],1)
  1 件のコメント
Baba
Baba 2011 年 10 月 31 日
Thank You!!!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by