フィルターのクリア

how to create 2 vectors from a matrix

1 回表示 (過去 30 日間)
tony karamp
tony karamp 2013 年 3 月 25 日
hello all,
I have a matrix called harm and I would like to create 2 vectors from that matrix, harmx and harmy. harmx would have the components i=1,3,5....39 while harmy will have i = 2,4,6...40.
I tried that, but it said that the Index exceeds the matrix dimensions
harmx []
harmy []
for i=1:40
if mod(i,2) == 0
harmx = harm(i);
else
harmy = harm(i);
end
end
Thank you in advance!
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 3 月 25 日
In your case, harm is not a matrix, it's a vector

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

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 3 月 25 日
harmx=harm(1:3:end)
harmy=harm(2:2end)

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by