필터 지우기
필터 지우기

CAT arguments dimensions are not consistent while applying a Despike Filter

조회 수: 1 (최근 30일)
xenon99942
xenon99942 2017년 8월 8일
댓글: xenon99942 2017년 8월 8일
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
Adam
Adam 2017년 8월 8일
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
xenon99942 2017년 8월 8일
The error was in line xi = [flipud(x(1:n)); x; flipud(x(end-n+1:end))];

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Electrophysiology에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by