How do I add a Table in App Designer?
82 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
With due respect, the instructions for App Designer are at best counter-intuitive and hermetic. For example, how to create a Table with 3 columns and 3 rows (besides the row of column headings), name columns AND rows, and populate the cells with Default values. Make these cell data entries editable by the user when running the app. The app sould take these Table data (and other data from the Slider, Knob, etc.), run a code that generates a plot.
I am stuck in trying to add Row Names. The User Community advises I need to add Table data first. But there seems to be no place in Design View to add such data!
11 Commenti
Adam Danz
il 20 Nov 2018
If you share that snippet of code I might be able to help. Also, I'll move the response to the 'answers' section so others may find it useful in the future.
ibenitoseb
il 10 Mar 2020
Here is a tutorial on adding rows and columns to tables in app designer:
Risposta accettata
Adam Danz
il 20 Nov 2018
Modificato: Adam Danz
il 20 Nov 2018
To add data to a UItable in App Designer, use the startupFcn() after creating the table in the UI.
- From the App Designer in design mode, right click anywhere on your app background, hover your mouse over 'callbacks', and add a startupFcn callback.
- Go to Code View and you'll see the startupFcn. Add your data to your table there. Refer to the documentation below to change other properties of the table.
app.UITable.Data = {1 2 3 4};
- Here is a list of all UItable properties available in App Designer.
- Here is a demo of changing those properties within the code.
- Examples of table array data stored in UITables in App Designer (2018a or later).
5 Commenti
Adam Danz
il 9 Mag 2023
In the link, see the image in the first step. You must select your app in the component browser.
Più risposte (2)
Paul Macey
il 17 Giu 2020
Modificato: Paul Macey
il 17 Giu 2020
Should really have a way to initalize in properties with at least one empty row.....
Here's what I did in the app startupFcn
app.ColorsUITable.Data = cell(1,length(app.ColorsUITable.ColumnName));
1 Commento
Adam Danz
il 18 Giu 2020
That is the way to initialize a table with 1 empty row.
For some data types you can use <missing>
Eric Sargent
il 9 Dic 2020
You can edit the RowName, ColumnName and ColumnEditable Properties of a UITable from the Property Inspector of App Designer.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/455944/image.jpeg)
You cannot add Data to a UITable from the Design View of App Designer, you will need to add the data in a StartupFcn (or other callback). For example
function startupFcn(app)
app.UITable.Data = rand(2,4);
end
Will result in:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/455949/image.png)
2 Commenti
Kristina Francke
il 1 Feb 2023
Modificato: Kristina Francke
il 1 Feb 2023
what if i want to add a value in Column 1 row Two only?
Vedere anche
Categorie
Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!