How to remove cell data from specific column using dates as a reference?
Mostrar comentarios más antiguos
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.
Respuestas (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 comentarios
muhammad choudhry
el 2 de Ag. de 2022
Editada: muhammad choudhry
el 2 de Ag. de 2022
Chunru
el 2 de Ag. de 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.
Categorías
Más información sobre Dates and Time en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!