adding structure in a table

I have a table called T which is a large dataset of 50 columns and 1000 rows. I have a struct called Table which has 4 fields as:
Table Year= 2012
Table Total= 2000
Table Length= 5 years
Can i somehow add this structure to my table properties?
Like this:
Description: 'Population Table'
UserData: []
DimensionNames: {'Row' 'Variables'}
VariableNames: {1×50 cell}
VariableDescriptions: {1×50 cell}
RowNames: {}
% TableInfo: Somewhere here?

답변 (1개)

madhan ravi
madhan ravi 2019년 8월 8일
편집: madhan ravi 2019년 8월 9일

0 개 추천

T = table((1:10).',(2:11).') % sample table
t.S = 1:5; % sample structure
t.K = rand;
f = fieldnames(t);
c = struct2cell(t);
T = addprop(T,f,repmat({'table'},size(f)))
for k = 1:numel(f)
T.Properties.CustomProperties.(f{k}) = c{k};
end
T.Properties

카테고리

도움말 센터File Exchange에서 Tables에 대해 자세히 알아보기

질문:

2019년 8월 8일

편집:

2019년 8월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by