writetable for a double entry table

14 ビュー (過去 30 日間)
Sim
Sim 2022 年 10 月 18 日
回答済み: Kevin Holly 2022 年 10 月 18 日
When I write a table with a double entry as a csv file....
labels_1 = {'FirstName' 'Height' 'Weight' 'BloodPressure'}
labels_1 = 1×4 cell array
{'FirstName'} {'Height'} {'Weight'} {'BloodPressure'}
labels_2 = {'Garcia' 'Johnson' 'Wu'}
labels_2 = 1×3 cell array
{'Garcia'} {'Johnson'} {'Wu'}
B = table({'Michael';'Beverly';'Alice'},...
[64;69;67],...
[119;163;133],...
[122 80; 109 77; 117 75],...
'VariableNames',labels_1,...
'RowNames',labels_2)
B = 3×4 table
FirstName Height Weight BloodPressure ___________ ______ ______ _____________ Garcia {'Michael'} 64 119 122 80 Johnson {'Beverly'} 69 163 109 77 Wu {'Alice' } 67 133 117 75
writetable(B,fullfile(path_save_table, 'B.csv'));
Unrecognized function or variable 'path_save_table'.
....the saved excel file does not show the first column on the left with the corresponding labels, i.e.:
labels_2 = {'Garcia' 'Johnson' 'Wu'}
Any suggestion in order to show the first column with the labels ?

採用された回答

Kevin Holly
Kevin Holly 2022 年 10 月 18 日
writetable(B,'B.csv','WriteRowNames',true);

その他の回答 (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