replacing every 30 data points with the mean of them, in an 8 column matrix x 65000 data points. Reshape error
조회 수: 1 (최근 30일)
이전 댓글 표시
This code has been running well for me and now all of a sudden i keep getting reshape error. i have changed nothing, but for some reason the data is being reshaped into a number not divisible by 30. I should be ending up with an 8 x 2166 matrix
%find the mean of every nth elements
n=30; % no. of samples to average at a time
filt_data=rmmissing(plot_thresh_data);
data_size=length(filt_data)-rem(length(filt_data),n);%make sure data is divisible by block size
y = filt_data(1:data_size,:); %resize data to divisible size
x =reshape(mean(reshape(y,n,[])),[],30);% replace each 30 data points with the mean of that 30
답변 (1개)
Matt J
2022년 1월 22일
편집: Matt J
2022년 1월 22일
I should be ending up with an 8 x 2166 matrix
I assume you mean 2166 x 8.
plot_thresh_data=rand(65000,8);
[M,N]=size(plot_thresh_data);
n=30; % no. of samples to average at a time
filt_data=rmmissing(plot_thresh_data);
data_size=M-rem(M,n);%make sure data is divisible by block size
y = filt_data(1:data_size,:); %resize data to divisible size
x =reshape(mean(reshape(y,n,[])),[],N);% replace each 30 data points with the mean of that 30
whos x
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!