Filter löschen
Filter löschen

How to explicit a cell array into a table

1 Ansicht (letzte 30 Tage)
Pas182
Pas182 am 16 Jun. 2022
Kommentiert: Walter Roberson am 23 Jun. 2022
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 Kommentare
Pas182
Pas182 am 16 Jun. 2022
It would works
Pas182
Pas182 am 17 Jun. 2022
@Walter Roberson could you help me with that please?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 19 Jun. 2022
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 Kommentare
Pas182
Pas182 am 19 Jun. 2022
Bearbeitet: Pas182 am 19 Jun. 2022
@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 am 23 Jun. 2022
T.Verification = cellfun(@(C) [C, strings(1,maxveln-length(C))].', T.Verification, 'uniform', 0);

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Cell Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by