replacing every 30 data points with the mean of them, in an 8 column matrix x 65000 data points. Reshape error
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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
Risposte (1)
Matt J
il 22 Gen 2022
Modificato: Matt J
il 22 Gen 2022
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 Commenti
Vedere anche
Categorie
Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!