How do I split a (2 x n x m) list of doubles into two separate lists of doubles 2 individual (n x m) lists of doubles?

2 ビュー (過去 30 日間)
I have a list of doubles, 2 x n x m. I tried a 'for' loop with something like this:
new_list_1 = []
for i = 1:n
for ii = 1:m
new_list_1(i,ii) = original(1,i,ii)
end
end
new_list_2 = []
for j = 1:n
for jj = 1:m
new_list_2(j,jj) = original(2,j,jj)
end
end
I can't think of a way to do this, many thanks.
  1 件のコメント
Stephen23
Stephen23 2015 年 11 月 4 日
編集済み: Stephen23 2015 年 11 月 4 日
How to do basic operations like this is introduced in the MATLAB introductory tutorials, under the section on Array Indexing:
with more info here:

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

採用された回答

Torsten
Torsten 2015 年 11 月 4 日
new_list_1(:,:)=original(1,:,:);
new_list_2(:,:)=original(2,:,:);
Best wishes
Torsten.

その他の回答 (1 件)

NiallH
NiallH 2015 年 11 月 4 日
Turns out I had not typed this in correctly, that was all. Thanks to both of you

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by