how to filter data in matlab like in excel

16 visualizaciones (últimos 30 días)
John
John el 26 de Nov. de 2013
Comentada: Nagarajan G el 17 de Mayo de 2020
Hi,
I have a variable 'data' with 2 columns, time (1-24) and energy consumption. I have a whole year of data. If I only wanted to look at the consumption at 10 pm, how could I filter out the energy consumption data points at 10pm?
Thanks for your help
  1 comentario
L K
L K el 11 de Sept. de 2016
Hi, i have a same problem, can you please tell me how to give the data(2 columns in excel file having phase and amplitude) to filter, i want the output of filter to be plot of phase and amplitude. pls help

Iniciar sesión para comentar.

Respuesta aceptada

Laurent
Laurent el 26 de Nov. de 2013
You can use indexing. For example:
tenpm=data(data(:,1)==22,2);
data(:,1)==22 selects only the rows in which the first column contains the value 22 (for 10 pm) and ',2' selects only the energy consumption values, which are then stored in the variable 'tenpm'. If you also want to keep the first column, you can change to:
tenpm=data(data(:,1)==22,:);
  5 comentarios
Atique Malik
Atique Malik el 4 de Mzo. de 2020
This is very good. How can this be extended so that the data that meets this condition is removed from teh original data?
Nagarajan G
Nagarajan G el 17 de Mayo de 2020
i am getting error .acually i have a design sheet xls.in that i want to filter only DS2211 card info.si i have used below comment.but its not working
[num,text,raw]=xlsread('filename.xlsx')
a=raw(raw(:,1)==DS2211.:);
kindly help me anybody if knows

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by