How to specify column names by writematrix function in Appdesigner?

조회 수: 6 (최근 30일)
I'm working in app designer. I store 4 columns of data to an excell file.
I have already specified the column names in excell and am using "VariableNamingRule", "preserve". But the column names are transformed into Var1, Var2 etc. or all column names are disappeared.
How do l solve this problem?
Thanks in advance!
  댓글 수: 1
piston_pim_offset
piston_pim_offset 2024년 4월 1일
Additionally, when writing data to excell sheet, template is gone (cell colors, text size etc.).

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

채택된 답변

Tiffany
Tiffany 2024년 4월 1일
편집: Tiffany 2024년 4월 1일
A potential workaround would be to first use array2table to convert the array into a table and set the column labels by using the property 'VariableNames'. Then you can use writetable to export the data to an excel file.
writetable(array2table(insert_data, 'VariableNames', insert_col_labels), 'filename.xls')
  댓글 수: 3
Tiffany
Tiffany 2024년 4월 2일
The following video details how to save data from MATLAB to Excel using a template: https://www.mathworks.com/videos/saving-data-from-matlab-to-excel-using-a-template-118948.html. I hope this helps!
piston_pim_offset
piston_pim_offset 2024년 4월 22일
@Tiffany it workes when "append" option is selected for "writemode" in writetable command. But, when I overwrite the data the template is gone.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by