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 次查看(过去 30 天)
% 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 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

产品


版本

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by