Converting all arrays inside a cell to tables

조회 수: 2 (최근 30일)
BN
BN 2020년 2월 9일
댓글: BN 2020년 2월 9일
Hello
I have a 40 x 32 cell named C. Each element in C has a dimension of 1 x 1 x 336. I want to keep C as a cell but converting every array in it to a table. In fact, I don't want first and second dimension (1 x 1), I just need 336 values. I want to have these values as a column. I attach C. I would like the output is a cell (40 x 32) with 336 x 1 table inside each cell.
Thank you so much.

채택된 답변

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2020년 2월 9일
newC is 40x32, each cell is a table 336x1 :
newC = cellfun(@(x) table(x(:)), C, 'uniformoutput', false)
  댓글 수: 1
BN
BN 2020년 2월 9일
Thank you. That exactly what I need.

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

추가 답변 (1개)

TADA
TADA 2020년 2월 9일
c = repmat({(1:10)'}, 3,3)
c =
3×3 cell array
Columns 1 through 2
{10×1 double} {10×1 double}
{10×1 double} {10×1 double}
{10×1 double} {10×1 double}
Column 3
{10×1 double}
{10×1 double}
{10×1 double}
c = cellfun(@table, c, 'uniformoutput', false)
c =
3×3 cell array
Columns 1 through 2
{10×1 table} {10×1 table}
{10×1 table} {10×1 table}
{10×1 table} {10×1 table}
Column 3
{10×1 table}
{10×1 table}
{10×1 table}
  댓글 수: 1
BN
BN 2020년 2월 9일
Dear TADA,
Thank you for your answer. I use this:
C = cellfun(@table, C, 'uniformoutput', false)
But unfortunately, it gained me 1 x 1 tables, and I missed 336 values of each cell.
Capture.JPG
When I click on one of them:
Capture2.JPG
I don't know what should I do, I need 336x1 tables in a cell.

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

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by