How to explicit a cell array into a table
1 次查看(过去 30 天)
显示 更早的评论
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!!!
回答(1 个)
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 个评论
Walter Roberson
2022-6-23
T.Verification = cellfun(@(C) [C, strings(1,maxveln-length(C))].', T.Verification, 'uniform', 0);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!