msresample error message: 'the point coordinates are not sequenced in strict monotonic order'
조회 수: 1 (최근 30일)
이전 댓글 표시
I am this error while trying to msresample a Orbi MS spectrum:
In msresample at 210
Error using griddedInterpolant
The point coordinates are not sequenced in strict monotonic order.
Error in interp1>Interp1D (line 335)
F = griddedInterpolant(X,V(:,1),method);
Error in interp1 (line 220)
Vq = Interp1D(X,V,Xq,method);
Error in msresample (line 304)
YOUT = interp1(X,YF,XOUT,'linear',0);
I am trying to resample only one spectrum, une imput is the exact export form xcalibur without headers. The code I am using is:
sample = importdata('C:\data\spectrum.csv', ',')
MZ = sample(:,1);
Y = sample(:,2);
[MZ1, Y1] = msresample(MZ, Y, 10000,'RANGE',[150 1200], 'Uniform', true, 'showplot', true)
I supposed it comes from the data itself because it is working with other MS data, but I dont know what is the problem.
댓글 수: 3
Walter Roberson
2012년 8월 10일
Heh. per meant please use markup to format the question; see http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup
I have done the formatting.
답변 (3개)
Wayne King
2012년 8월 9일
Which version of Matlab are you using? Am I not able to reproduce this error, but out of curiousity, why are you setting the range like that so far outside of the range of your X-values?
[MZ1, Y1] = msresample(MZ, Y, 10000,'RANGE',[min(MZ) max(MZ)], 'Uniform', true, 'showplot', true);
Wayne King
2012년 8월 10일
편집: Wayne King
2012년 8월 10일
Then the problem in your MZ vector is not in the portion that you have shown us, because the above works in R2012a.
The issue is that somewhere in your MZ vector, the values are not monotonically increasing. If you do a diff() on your MZ vector you should see that all the values are positive, if not, you will get that error. To reproduce that error try:
% this works
x = 1:6;
y = randn(6,1);
xout = 1:0.1:6;
yout = interp1(x,y,xout,'cubic',0);
% this will give you the error you observe
x(5) = 6;
% now x is not monotonic
% x is [1 2 3 4 6 6]
diff(x) % see the zero? now here is your error
yout = interp1(x,y,xout,'cubic',0);
Nicolas Ummen
2013년 5월 8일
I had a similar problem involving interpolation just now.
Additionally, even if the find(diff(x)>0), resp. find(diff(x)<0) doesn't give suspicious points, check whether the points are too close together anyway.
After filtering measurements and measurement times which were less than 0.0001 timeunits apart, my interpolation worked just fine. It reduced my dataset from 7000 points to 6700 points. But since I am interpolating anyway, I won't miss these.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!