App Designer Table setting column name to variable name

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

댓글 수: 1

I'm having the same problem. I think it must be a bug, as the documentation clearly says the UITable should inherit the names from the table used to define it.

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

 채택된 답변

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

Thank you! :)
Yes, that works. But unfortunately it updates then the UItable two times.
For larger tables not a perfect solution.
It works. Thanks man. For someone else: remember that DataTable is the name of your table.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

질문:

2019년 6월 3일

댓글:

2025년 8월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by