Add column and row headers to a matrix for export

11 ビュー (過去 30 日間)
GGM
GGM 2020 年 4 月 23 日
回答済み: Ganesh Regoti 2020 年 4 月 29 日
I have a 46 x 46 matrix and I want to export the data with headers. Currently I am using xlswrite but it doesn't seem very stable and the file takes a long time to open.
RowNames = cellstr(headers);
col_header= RowNames';
row_header= RowNames;
xlswrite('TtestResults.xls',results,'Sheet1','B2');
xlswrite('TtestResults.xls',col_header,'Sheet1','B1');
xlswrite('TtestResults.xls',row_header,'Sheet1','A2');
MatLab doesn't recommend to use xlswrite but I don't know another function that will still put the matrix and headers in the correct orientation. Any ideas would be much appreciated
  1 件のコメント
KSSV
KSSV 2020 年 4 月 23 日
Convert the matrix, into a table using table and use writetable.

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

回答 (1 件)

Ganesh Regoti
Ganesh Regoti 2020 年 4 月 29 日
Hi,
I assume that you want to store the data in matrix with headers in .xls file. You could use following functions to achieve it
  1. array2table
  2. writetable
I found a similar question in MATLAB Answers which you can refer to
Hope this helps!

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by