What is the best way of deleting multiple rows of a uitable using a pushbutton?
    4 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
I am creating a to-do list where entries, dates, identification of importance are each column in a uitable. I want to delete one or more rows depending on what the user selects or identifies with a delete button that is also in the GUI.
0 Kommentare
Antworten (1)
  Walter Roberson
      
      
 am 14 Apr. 2017
        Use the same kind of vector of handles that we discussed in https://www.mathworks.com/matlabcentral/answers/334500-how-to-sort-string-in-a-list-of-edit-box-based-on-a-toggle-buttons-for-each-of-them#answer_262392
When you have converted the vector of checkbox values from cell to matrix, then you can logical() that to get a mask. The mask would correspond to entries to delete. For your purpose it is probably easier to use a vector of things to save:
   mask = logical(MatrixCheckboxesValue);
   IndexC = ~mask;
Then this next section is copied directly from that previous code:
   ReorderCheckboxes = CheckboxesVValue(IndexC);
   ReorderEntryEdits = EntryEditsVString(IndexC);
   ReorderDueDateEdits = DueDateEditsVString(IndexC);
   ReorderImportantToggles = ImportantTogglesVValue(IndexC);
but only a subset of the locations are to be changed:
   num_kept = sum(IndexC);
   set( DueDateEditsV(1:num_kept), {'String'}, ReorderDueDateEdits);
   set( EntryEditsV(1:num_kept), {'String'}, ReorderEntryEdits);
   set( CheckboxesV(1:num_kept), {'Value'}, ReorderCheckboxes);
   set( ImportantTogglesV(1:num_kept), {'Value'}, ReorderImportantToggles);
After that, you have some unused entries to deal with, the ones from num_kept+1:end . You could delete them, or you could set their visible off and put them in a pool of already-created objects ready for re-use.
0 Kommentare
Siehe auch
Kategorien
				Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

