フィルターのクリア

How to save UITable into Excel for AppDesigner MATLAB?

51 ビュー (過去 30 日間)
Arif Adam Bin Mohd Nor
Arif Adam Bin Mohd Nor 2020 年 7 月 13 日
編集済み: Adam Danz 2020 年 7 月 14 日
Hi. I created a UITable with 4 columns (A,B,C,D). All data are numericals. When I press the button 'RUN' the tables were tabulated automatically. How do I automatically save the table in an Excel file when I press 'RUN'? How should I code in the 'code view'? I am using R2016B version. Thank you.

採用された回答

Adam Danz
Adam Danz 2020 年 7 月 13 日
編集済み: Adam Danz 2020 年 7 月 14 日
The data are stored in the Data property of a UITable within a mxn cell array. For Matlab r2019a or later, use writecell() to write the data to an excel file. Prior to that, use xlswrite().
It will look something like this.
data = app.UITable.Data;
filename = 'testdata.xlsx';
writecell(data,filename)
Here's a full demo
  6 件のコメント
Arif Adam Bin Mohd Nor
Arif Adam Bin Mohd Nor 2020 年 7 月 14 日
I did mention the version I am using in my question in the last sentence before 'Thank you'. which is the R2016B release. Thank you.
Adam Danz
Adam Danz 2020 年 7 月 14 日
Oh, I see it now in your question. Thanks for including it. If you look to the right, there's a "Products" and "Release" field where you can fill in your release while you're writing your question. That's where I usually look.
The functions I recommended were released in r2019a which is why you're getting those errors.
Looks like you'll need to use xlswrite(filename,A)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by