Splitting a cell in two.

1 回表示 (過去 30 日間)
Anders Mahler
Anders Mahler 2014 年 10 月 2 日
コメント済み: Anders Mahler 2014 年 10 月 3 日
Hello, i have a cell struture with different vectors, ( 220x1 double 87x1 double 175x1 double 102x1 double 165x1 double 123x1 double), that i would like to split i 2 cells, where 1st, 3rd.ect. vector goes in the first, and the 2nd, 4thn ect. goes in the second. Not alle my cells are of the same length. Does anybody know of a smart function? Best Regards Anders

採用された回答

Stephen23
Stephen23 2014 年 10 月 2 日
編集済み: Stephen23 2014 年 10 月 2 日
MATLAB's indexing is pretty good at doing these kind of things:
A = {vec1,vec2,vec3,vec4...};
B = A(1:2:end);
C = A(2:2:end);
And it does other neat things too:
  1 件のコメント
Anders Mahler
Anders Mahler 2014 年 10 月 3 日
Thanks a lot, short af effective, perfect.

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

その他の回答 (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