uitable create modify and save
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I have a 2D table and I would like to display this table and select some of lines of this table. I think the best is to create another column in my table set at 0 and when I want to select some line, I modify 0 to 1. After, I want to close the window (with a button) and retrieve the table (modified) in my Matlab workspace.
For that I choose to create an uitable. But I did not find how to :
- Create another column to select the lines I want.
- Create a uitable I can close with a button
- Retrieve the table with the last column.
Thanks,
Pierre
1 commentaire
Mohammad Sami
le 21 Jan 2020
Just add an extra column to your data, then set as the Data property of the uitable.
After you are done with the updates, retreive the Data property to see what was selected.
% change yourdata to your variable name . type is table
yourdata.lastcol = false(height(yourdata),1);
f = uifigure('CloseRequestFcn',@(varargin)uiresume(gcbf));
editcols = false(1,width(yourdata));
editcols(end) = true;
t = uitable(f,'Data',yourdata,'ColumnEditable',editcols);
uiwait(f); % this will block until the figure is closed.
updatedata = t.Data;
close(f);
delete(f);
Réponses (1)
Payas Bahade
le 24 Jan 2020
Hi Pierre-François,
I have created a demo App in App Designer which can be used to retrieve selected lines from given table. Refer to the .mlapp file in attachment.
Instead of making use of ‘0’ or ‘1’, I have used a separate checkbox column to select the rows whose data needs to be retrieved in a variable ‘newTable’ in MATALB workspace.
Hope this helps!
Voir également
Catégories
En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!