How can I make the cells in a UITable editable in an App Designer app?

30 Ansichten (letzte 30 Tage)
How can I make the cells in a UITable editable in an App Designer app?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 17 Jan. 2025
Bearbeitet: MathWorks Support Team am 3 Feb. 2025
The property that allows the UITable to be edited by the user of the App is "ColumnEditable".
See the attached screenshot below for the user interface for modifying the "ColumnEditable" property to "true" (without quotes) for the UITable in App Designer:
To access the documentation for the "ColumnEditable" property specific to MATLAB R2019b, please execute the following command in the MATLAB command window:
>> web(fullfile(docroot, 'matlab/ref/matlab.ui.control.tableappd-properties.html'))
You can also set this programmatically by writing
app.UITable.ColumnEditable = true
This will allow users of the App to modify every cell in the table.
If you want to allow modification to only some columns, for example the first static and the second editable, you can set this value to a logical array like this:
app.UITable.ColumnEditable = [false, true];
After a user makes edits, it can be helpful to use the new data or indices in the app.
As an example, you could write the table to a file for later use using the UITable "CellEditCallback":
% Cell edit callback: UITable function UITableCellEdit(app, event)   indices = event.Indices; newData = event.NewData; writetable(app.UITable.Data, "test.xlsx") end
For more details on "writetable", you can access the relevant documentation for MATLAB R2019b by executing the following command:
>> web(fullfile(docroot, 'matlab/ref/writetable.html'))
To search for information regarding the current release, please follow the link below:

Weitere Antworten (0)

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by