Splitting a cell in two.

조회 수: 7 (최근 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 CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by