msresample error message: 'the point coordinates are not sequenced in strict monotonic order'

3 次查看(过去 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 个评论
Aurelie
Aurelie 2012-8-9
编辑:Aurelie 2012-8-9
The format of input data was .csv or .txt(\t), it was the export of Xcalibur, without headers:
  • 150.0263 67.5
  • 150.0766 61.9
  • 150.0917 51.4
  • 150.1125 989
  • 150.2732 50.9
  • 150.2906 38.4
  • 150.2951 62.4
  • 150.3522 52.5
  • 150.3942 59
  • 150.4493 37.5
  • 150.5785 68.9
  • 150.7795 44.8
  • 150.8605 64.3
  • 150.9178 52.6
  • 151.0224 55.5
  • 151.0966 288.6
  • 151.196 56.1
  • 151.2886 53.6
  • 151.3341 82.6
  • 151.3397 58.1
  • 151.8476 54.8
  • 151.8955 49
  • 151.9627 40.3
  • 152.0323 131.4
  • 152.0333 113.2

请先登录,再进行评论。

回答(3 个)

Wayne King
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
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);
  3 个评论

请先登录,再进行评论。


Nicolas Ummen
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.

标签

Community Treasure Hunt

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

Start Hunting!

Translated by