Add row name from uitable to excel

15 views (last 30 days)
Miss B
Miss B on 2 Apr 2020
Commented: Adam Danz on 6 Apr 2020
Hello,
I figured out how to export 'ColumnNames' from uitable to Excel Spreadsheet.
But how would I do the same for 'RowNames'?
Any help will be appreciated.
Thank you!
  1 Comment
Aditya Pathak
Aditya Pathak on 2 Apr 2020
Can you please share the codeline in order to receive help?

Sign in to comment.

Answers (1)

Peng Li
Peng Li on 2 Apr 2020
Better using writetable in this case I think. You can specify WriteRowNames as true.
writetable(yourTable, filename, “WriteRowNames”, 1);
  2 Comments
Adam Danz
Adam Danz on 6 Apr 2020
+1, clean and effective approach.
But only these lines are needed and you should use the full path to the file.
function save1_Callback(hObject, eventdata, handles)
[filename,pathname]= uiputfile('*.xls','Save as');
writetable(handles.table1, fullfile(pathname, filename), 'WriteRowNames', 1);

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by