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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!