how to filter data in matlab like in excel

조회 수: 16 (최근 30일)
John
John 2013년 11월 26일
댓글: Nagarajan G 2020년 5월 17일
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
L K
L K 2016년 9월 11일
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

댓글을 달려면 로그인하십시오.

채택된 답변

Laurent
Laurent 2013년 11월 26일
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
Atique Malik
Atique Malik 2020년 3월 4일
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 2020년 5월 17일
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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by