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 Center および File ExchangeGet 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