Cell2mat with different rows

조회 수: 1 (최근 30일)
주희 박
주희 박 2022년 6월 21일
댓글: 주희 박 2022년 6월 21일
Hi, I want to convert cell to array or double no matter except cell. So I tried cell2mat but I got an error because each cell has different rows.
I attached simple cell consist of different rows.
Thanks.

채택된 답변

Stephen23
Stephen23 2022년 6월 21일
S = load('Cell.mat')
S = struct with fields:
A: {3×1 cell}
A = S.A
A = 3×1 cell array
{[ 1 2 3 1 2 3 1 2 3 1 2 3]} {[4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5]} {[ 6 7 8 9 10 6 6 6 6 6]}
M = padcat(A{:})
M = 3×22
1 2 3 1 2 3 1 2 3 1 2 3 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 4 5 6 7 8 9 10 6 6 6 6 6 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
  댓글 수: 1
주희 박
주희 박 2022년 6월 21일
Thank you so much. This is what i want !

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by