Add row name from uitable to excel

조회 수: 5 (최근 30일)
Miss B
Miss B 2020년 4월 2일
댓글: Adam Danz 2020년 4월 6일
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
Aditya Pathak
Aditya Pathak 2020년 4월 2일
Can you please share the codeline in order to receive help?

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

답변 (1개)

Peng Li
Peng Li 2020년 4월 2일
Better using writetable in this case I think. You can specify WriteRowNames as true.
writetable(yourTable, filename, “WriteRowNames”, 1);
  댓글 수: 2
Peng Li
Peng Li 2020년 4월 3일
편집: Peng Li 2020년 4월 3일
function save1_Callback(hObject, eventdata, handles)
[filename,pathname]= uiputfile('*.xls','Save as');
col=get(handles.table1,'columnname')' ;
data=get(handles.table1,'data');
num=[col;data];
% changes
writetable(handles.table1, filename, 'WriteRowNames', 1);
xlswrite([pathname filename],num);
Adam Danz
Adam Danz 2020년 4월 6일
+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);

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

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by