Filtering Table by Date; Separate loops & functions does not work. Need to filter From date 1st then To date to create range of time for data table to output data in time rang
1 view (last 30 days)
Show older comments
% Value changed function: FROMDatePicker
function FROMDatePickerValueChanged(app, event)
app.Filter_FromDate = app.FROMDatePicker.Value;
numRows = size(app.UITable2.Data,1);
r = 1;
for i = 1:numRows
if app.UITable2.Data{i,3} >= app.Filter_FromDate
app.RowstoDel(r,1) = i;
r = r + 1;
elseif app.UITable2.Data{i,3} <= app.Filter_ToDate
end
end
app.UITable2.Data = app.UITable2.Data(app.RowstoDel,:);
%app.UITable2.Data(app.RowstoDel,:) = [];
end
% Value changed function: TODatePicker
function TODatePickerValueChanged(app, event)
app.Filter_ToDate = app.TODatePicker.Value;
numRows = size(app.UITable2.Data,1);
r = 1;
for i = 1:numRows
if app.UITable2.Data{i,3} <= app.Filter_ToDate
app.RowstoDel(r,1) = i;
r = r + 1;
%app.UITable2.Data(i,:) = [];
end
end
app.UITable2.Data = app.UITable2.Data(app.RowstoDel,:);
%app.UITable2.Data(app.RowstoDel,:) = [];
0 Comments
Answers (0)
See Also
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!