필터 지우기
필터 지우기

How to explicit a cell array into a table

조회 수: 1 (최근 30일)
Pas182
Pas182 2022년 6월 16일
댓글: Walter Roberson 2022년 6월 23일
Hi everyone!
I'm trying to create a table with some informations as below:
Dtc=transpose(DTC);
Lamp=transpose(Lamp_config);
Verification=transpose(answer);
T=table(Dtc,Lamp,Verification)
Verification column is a cell array like below:
and I'd like to explicit in the table the (i,j) cells which are like:
Which is the best way to do it?
Thank you so much in advance!!!
  댓글 수: 4
Pas182
Pas182 2022년 6월 16일
It would works
Pas182
Pas182 2022년 6월 17일
@Walter Roberson could you help me with that please?

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

답변 (1개)

Walter Roberson
Walter Roberson 2022년 6월 19일
vlens = cellfun(@length, T.Verification);
maxvlen = max(vlens);
T.Verification = cellfun(@(C) [C;strings(maxveln-length(C),1)].', T.Verification, 'uniform', 0);
T = splitvars(T);
  댓글 수: 2
Pas182
Pas182 2022년 6월 19일
편집: Pas182 2022년 6월 19일
@Walter Roberson thank you so much for your help. I'm getting this error:
can you help on this? P.S. I'm using Matlab 2016b version
Walter Roberson
Walter Roberson 2022년 6월 23일
T.Verification = cellfun(@(C) [C, strings(1,maxveln-length(C))].', T.Verification, 'uniform', 0);

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

카테고리

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