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 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!