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);
3 件のコメント
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!