adding a blank row after a populated row on a Table

11 ビュー (過去 30 日間)
Eth
Eth 2019 年 5 月 15 日
編集済み: madhan ravi 2019 年 5 月 15 日
From the MATLAB Table examples:
LastName = {'Sanchez';'Johnson';'Li';'Diaz';'Brown'};
Age = [38;43;38;40;49];
Smoker = logical([1;0;1;0;1]);
Height = [71;69;64;67;64];
Weight = [176;163;131;133;119];
BloodPressure = [124 93; 109 77; 125 83; 117 75; 122 80];
K>> T = table(LastName,Age,Smoker,Height,Weight,BloodPressure)
T =
5×6 table
LastName Age Smoker Height Weight BloodPressure
_________ ___ ______ ______ ______ _____________
'Sanchez' 38 true 71 176 124 93
'Johnson' 43 false 69 163 109 77
'Li' 38 true 64 131 125 83
'Diaz' 40 false 67 133 117 75
'Brown' 49 true 64 119 122 80
How can I add blank rows to the table? so that the table becomes :
LastName Age Smoker Height Weight BloodPressure
_________ ___ ______ ______ ______ _____________
empty empty empty empty empty empty
'Sanchez' 38 true 71 176 124 93
empty empty empty empty empty empty
'Johnson' 43 false 69 163 109 77
empty empty empty empty empty empty
'Li' 38 true 64 131 125 83
empty empty empty empty empty empty
'Diaz' 40 false 67 133 117 75
empty empty empty empty empty empty
'Brown' 49 true 64 119 122 80
empty empty empty empty empty empty

採用された回答

madhan ravi
madhan ravi 2019 年 5 月 15 日
t1=repmat({'empty'},size(T));
D=cell(2*size(T,1),size(T,2));
D(1:2:end,:)=t1;
D(2:2:end,:)=table2cell(T);
Wanted=cell2table(D)
Wanted.Properties.VariableNames=T.Properties.VariableNames
  3 件のコメント
Eth
Eth 2019 年 5 月 15 日
Is there a way to make all the cells in the table editable? I tried but it does not work.
set(Wanted,'ColumnEditable',true(1,3))
madhan ravi
madhan ravi 2019 年 5 月 15 日
編集済み: madhan ravi 2019 年 5 月 15 日
Perhaps what your looking for is https://in.mathworks.com/help/matlab/ref/uitable.html. Sorry, I’m not familiar with guis.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by