Remove spikes from a matrix.
6 次查看(过去 30 天)
显示 更早的评论
Hey all!
I've got a huge matrix of 3587 x 5677056, and I've got to find the average (avg) of this matrix and the standart deviation (sd) for removing the spike values that are along the matrix. So, I will remove all the values of my matrix that are greater than (avg + 3 sd). I've build up the following code:
media_total = NaNmean(matriz_total, 'all');
x = (avg + 3sd)
L = bsxfun(@le,media_total,x);
media_total(L) = NaN;
But I'm getting the following error:
Error using size
Dimension argument must be a positive integer scalar within indexing range.
Error in nanmean (line 43)
count = size(x,dim) - sum(nans,dim);
Does anyone know how to solve it?
And aftewards, how can I effectively remove all the values greater than (avg + 3 sd) and substitute these values for NaN?
Thank's very much for any help!!!
Regards, Paulo Beiral.
0 个评论
采纳的回答
Daniel M
2019-10-16
My version of nanmean only goes up to line 22 in R2019a, so I'm not sure what you have. Perhaps someone has written an overloaded version of that function. What happens when you type this into the command window:
which nanmean
Regardless, this is fairly simple. Other than the fact that a matrix that size of type double would be 162 GB.
xm = nanmean(x,'all');
xs = nanstd(x,0,'all');
x(x > xm+3*xs) = NaN;
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!