Filtering Table in app designer
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a table in app designiner and I adding a feature to filter the data and delter it if it's over a selected value, but with the loop i made it only deletes one of the last value that is taken into the rowsdelt variable? am I just storing the rows wrong I bet its s simple fix I'm just stuck.
Filter=app.CutOffValueEditField.Value;
n=size(app.t,1);
k=1
if(app.LowPassButton.Value)
for i=1:n
if app.UITable3.Data(i,app.ColumnNumberbeingevalulatedEditField.Value)>=Filter
rowsdelt(1,k)=i
end
end
app.UITable3.Data(rowsdelt,:)=[];
0 Commenti
Risposte (1)
Deepak
il 29 Ago 2024
Hi @Kyle Koutonen, it is my understanding, that you have created a table in the app designer, and you want to filter the table and delete the rows that are over a selected value. However, the loop you have written deletes only the last row and not all the required rows.
Upon investigation of the code, the issue seems to be that "k" is not being incremented in the for loop. This results in only the last row index being stored in "rowsdelt". Also, the variable "rowsdelt" needs to be initialized properly before the “for loop” to store the values.
Here is the updated MATLAB code with changes:
Filter = app.CutOffValueEditField.Value;
n = size(app.t, 1);
k = 1;
rowsdelt = []; % Initialize rowsdelt as an empty array
if app.LowPassButton.Value
for i = 1:n
if app.UITable3.Data(i, app.ColumnNumberbeingevalulatedEditField.Value) >= Filter
rowsdelt(1, k) = i; % Store the index of the row to delete
k = k + 1; % Increment k to store the next row index
end
end
app.UITable3.Data(rowsdelt, :) = [];
end
I hope this resolves the issue.
0 Commenti
Vedere anche
Categorie
Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!