Update on filtering table
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Kyle Koutonen
am 1 Mär. 2021
Bearbeitet: Cris LaPierre
am 1 Mär. 2021
I posted a question on here the other day about filtering and it hasn't been answered yet, i made some changes to it but still have issue so I'm hoping if there are two posts one will be answered. So i made the loop to store which rows have values over the cut off value, the only problem is when row is under the cut off value a zero is put into the rows delt vector which screws up the deleteing of rows since the Table cannot have a zero input.
Filter=app.CutOffValueEditField.Value;
n=size(app.t,1);
if(app.LowPassButton.Value)
for i=1:n
if app.UITable3.Data(i,app.ColumnNumberbeingevalulatedEditField.Value)>=Filter
rowsdelt(i)=i
end
end
app.UITable3.Data(rowsdelt,:)=[];
0 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 1 Mär. 2021
Bearbeitet: Cris LaPierre
am 1 Mär. 2021
Use logical indexing instead. You can do that without the for loop. (untested)
if ...
rowsdelt = app.UITable3.Data(:,app.ColumnNumberbeingevalulatedEditField.Value)>=Filter;
app.UITable3.Data(rowsdelt,:)=[];
end
Note that you'll want the delete command inside the if statement or you'll get an error about undefined variable rowsdelt anytime app.lowpassbutton.value is false.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical 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!