Filter löschen
Filter löschen

CAT arguments dimensions are not consistent while applying a Despike Filter

2 Ansichten (letzte 30 Tage)
Hi all! i was applying a simple despike filter based on a median filter and got the above error message that CAT arguments dimensions are not consistent.
%extend data vector by n data points at both ends
xi = [flipud(x(1:n)); x; flipud(x(end-n+1:end))];
%apply order n median filter
xfilt = medfilt1(xi,n);
%difference to filterd data
dif = abs(xfilt(1+n:end-n)-x);
%number of spikes
nspike = sum(dif>lim);
%replace spikes with NaNs
x(dif>lim) = NaN;
xout = x;
Where x is the input data (in my case a 1290x6 array), n is order of median filter (n=3 detects spikes consisting of single data points only) and lim is the detection limit (which i set to 4), i.e spike if x(i)-x_filtered(i)>lim .
This filter wordke quite well with other data, i dont see the problem. Thanks for your help!
  2 Kommentare
Adam am 8 Aug. 2017
Have you used the debugger and the 'Stop on errors' option from the Breakpoints menu in the editor? These kind of errors are usually trivial to find in seconds if you do that. Whether they are so easy to fix depends entirely on what went wrong and what you intended etc, but at least understanding why the error occurs is very easy.
xenon99942 am 8 Aug. 2017
The error was in line xi = [flipud(x(1:n)); x; flipud(x(end-n+1:end))];

Melden Sie sich an, um zu kommentieren.

Antworten (0)


Mehr zu Electrophysiology finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by