Concatenating double arrays from same cell array

조회 수: 1 (최근 30일)
MiauMiau
MiauMiau 2017년 1월 29일
편집: MiauMiau 2017년 1월 29일
Hi
I know how to concatenate elements of two cells with cellfun, however I want to concatenate double arrays of the same cell to each other, and save this concatenation as the only remaining element of the cell. So, if my cell has 3 elements, the first is a 5x1 double array, the second element is an empty array, the third is a 3x1 double array, I would like to have at the end a 5x1 array in mycell{1}. How would I do that? Many thanks
  댓글 수: 2
Jan
Jan 2017년 1월 29일
편집: Jan 2017년 1월 29일
I don't get it. You start with:
C = {(1:5).', [], (6:8).'}
Then want is the wanted {[5x1]} output?
MiauMiau
MiauMiau 2017년 1월 29일
편집: MiauMiau 2017년 1월 29일
C = {(1:8)'} would be the wanted output

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2017년 1월 29일
Perhaps you do not want a {[5x1]} but {[8x1]} result?
C = {(1:5).', [], (6:8).'};
D = {cat(1, C{:})};

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by