How to add headers to Excel.

110 ビュー (過去 30 日間)
Daniel Boateng
Daniel Boateng 2019 年 6 月 14 日
回答済み: Are Mjaavatten 2019 年 6 月 14 日
I am trying to add headers name and age to the excel i create for c but its not working.
Any help please?
filename = 'testdata.xlsx';
header = {'name', 'Age'};
A = [12.7;5.02;-98;63.9;0;-.2;56];
B= [12.7;5.02;-98;63.9;0;-.2;56];
c= [A,B];
xlswrite(filename,header,c)

採用された回答

Are Mjaavatten
Are Mjaavatten 2019 年 6 月 14 日
filename = 'testdata.xlsx';
header = {'name', 'Age'};
A = [12.7;5.02;-98;63.9;0;-.2;56];
B= [12.7;5.02;-98;63.9;0;-.2;56];
c = cell(8,2);
c(1,:) = header;
c(2:8,:) = num2cell([A,B]);
xlswrite(filename,c);

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by