Add column and row headers to a matrix for export

조회 수: 46(최근 30일)
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;
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 2020년 4월 23일
Convert the matrix, into a table using table and use writetable.

댓글을 달려면 로그인하십시오.


Ganesh Regoti
Ganesh Regoti 2020년 4월 29일
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!

Community Treasure Hunt

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

Start Hunting!

Translated by