Sliding window binning and average
이전 댓글 표시
Hi all, I have data in a .csv file with two difderent columns and each column has 245438 row. Please kindly help me to find a MATLAB code to bin the first column with a sliding window of 30 and threshold 1 and make an average of corresponding data in second column for each bin.
답변 (1개)
Mehmed Saad
2020년 4월 20일
0 개 추천
- Read data from csv file using readtable, suppose you store it in variable T and the two column of tables are C1 and C2. To access first column use , T.C1 and for 2nd use T.C2
- For sliding window, use conv or filter maybe with (ones(1,30))
- After filtering, apply threshold by comparing result of step 2 with threshold i.e 1
댓글 수: 6
Farshad Daraei Ghadikolaei
2020년 4월 20일
Mehmed Saad
2020년 4월 20일
so you mean in third column of your dataset, the size of each row is 30 [1-30,2-31,3-32,.,.]
in fourth column you take average
But how are you suppose to plot 3rd column against 4rth
are you suppose to plot 30 values of 3rd column against 1 value of 4rth column?
Mohammad Sami
2020년 4월 20일
편집: Mohammad Sami
2020년 4월 20일
"I need to have a third column in my datasheet, that bin the first column like this: first bin: data no. 1 to data no. 30"
Did you mean the first value in third column is the sum of row 1 to 30 of the first column. Or do you want to calculate and average or some other stats ?
Farshad Daraei Ghadikolaei
2020년 4월 20일
Farshad Daraei Ghadikolaei
2020년 4월 20일
Mehmed Saad
2020년 4월 21일
Great
카테고리
도움말 센터 및 File Exchange에서 Performance and Memory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!