How can i clear a row or all rows of UItable in AppDesigner?

21 vues (au cours des 30 derniers jours)
Aiden Su
Aiden Su le 5 Mai 2022
Commenté : Geoff Hayes le 6 Mai 2022
clear one row:
clear all rows:
what i wanted is shown in these pictures, how can i do this? I'd appreciate some help.
  3 commentaires
Aiden Su
Aiden Su le 6 Mai 2022
Sorry, I don't make myself clear. Yes I would like to use a push button to achieve this and i prefer to clear all rows.
Geoff Hayes
Geoff Hayes le 6 Mai 2022
Please see @Mitch Lautigar's answer below.

Connectez-vous pour commenter.

Réponses (1)

Mitch Lautigar
Mitch Lautigar le 5 Mai 2022
For UItables, you need to set "editable" to on so you can change the values of the table programatically. After that, it's just a matter of stepping through the UI structure to get to the table parameters. I have two things to point you too in the hopes it helps.
  1. https://www.mathworks.com/matlabcentral/answers/40789-is-there-a-way-to-delete-a-whole-row-in-a-uitable-by-clicking-a-delete-row-button --- This question was asked previously, and helped me to do this in a personal GUI of mine.
  2. https://www.mathworks.com/help/matlab/ref/matlab.ui.control.table-properties.html --- This has table properties. The property you are looking for I believe is "data"
  1 commentaire
Aiden Su
Aiden Su le 6 Mai 2022
Modifié(e) : Aiden Su le 6 Mai 2022
properties (Access = private)
Indices_h = 0;
end
function height_clean_ButtonPushed(app, event)
ind = app.Indices_h;
if ind == 0
app.HeightTable.Data(end,:) = [];
end
end
Thank you for your help, I find a way that can clear the last row of UItable by default.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by