How to remove cell data from specific column using dates as a reference?
Show older comments
Hi,
I am analysing the flowrate data in which there are fluctuations due to errors. I would like to remove the errors using dates as a reference. Currently I am just doing manually in excel. Is there any easy way to do in matlab? With the file attached I am trying to remove the data from 11/05/2020 till 28/09/2020 of flowrate_5 (in a flowrate tab). cells and want them cells to be empty. your help would be much appreciated.
Code:
file_list = readtable('flowrate_dates.xlsx','flowrate');
I am googling but not getting more then one line, I can further mention the cell range but i want to remove the data using the date range which I do not know how to do it.
Answers (1)
T = readtable("https://www.mathworks.com/matlabcentral/answers/uploaded_files/1085695/flowrate_dates.xlsx", "Sheet", 3)
idx = T.Dates >= datetime('11/05/2020', 'InputFormat', 'dd/MM/yyyy') & ...
T.Dates <= datetime('28/09/2020', 'InputFormat', 'dd/MM/yyyy');
%T(idx, :) =[];
T.Flowrate_5(idx) = nan;
T(30:50,:)
2 Comments
muhammad choudhry
on 2 Aug 2022
Edited: muhammad choudhry
on 2 Aug 2022
Chunru
on 2 Aug 2022
If you eant to "remove" the values for flowrate_5 within the period specified while keeping other columns, you can assign the nan value for them. See updated above.
Categories
Find more on Tables 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!