App Designer Table setting column name to variable name

32 ビュー (過去 30 日間)
JessHmann
JessHmann 2019 年 6 月 3 日
Hello,
I am using app designer and have a few uitables. However I am struggling to get the column names to automatically match the variable names as stored in my tables.
I know I can set them manually, but I would like them to be set automatically as the tables might still chnge in the future.
I found the correct documentation but am not sure how to change the property
"When you specify the Data property of a Table UI component as a table array, MATLAB sets the format of the Table UI component automatically based on the values in the table array:
  • By default, the column names displayed in the app match the VariableNames property of the table array"
This is how I set my data:
app.Table1.Data=DataTable; %Data table is a saved table in my database

採用された回答

Jonathan Walford
Jonathan Walford 2019 年 6 月 20 日
編集済み: Jonathan Walford 2019 年 6 月 20 日
I was trying to find an answer to this too. In the absence of any other replies.
app.Table1.ColumnName = DataTable.Properties.VariableNames ;
seems to work, but I am not sure if this qualifies as "automatic".
  3 件のコメント
memam
memam 2022 年 9 月 22 日
Yes, that works. But unfortunately it updates then the UItable two times.
For larger tables not a perfect solution.
Edwin Henry Jara Bardales
Edwin Henry Jara Bardales 2022 年 10 月 16 日
It works. Thanks man. For someone else: remember that DataTable is the name of your table.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop 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