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

1 visualizzazione (ultimi 30 giorni)
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 Commenti
Aurelie
Aurelie il 9 Ago 2012
Modificato: Aurelie il 9 Ago 2012
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

Accedi per commentare.

Risposte (3)

Wayne King
Wayne King il 9 Ago 2012
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 il 10 Ago 2012
Modificato: Wayne King il 10 Ago 2012
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 Commenti

Accedi per commentare.


Nicolas Ummen
Nicolas Ummen il 8 Mag 2013
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.

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by