What is the solution for "Error using griddedInterpolant The grid vectors must contain unique points."

2 ビュー (過去 30 日間)
Hi,
I need to interpolate the data of 243 frame into 51 frame which 0 to 100%. However, the result shows
"Error using griddedInterpolant The grid vectors must contain unique points."
I'm not sure how to solve the error and what is the meaning of unique points.
Thank you in advance.
X=xlsread('JRF DATA 10DEG.xlsx',1,'J4:M243');
% Make original data
oldPcntValsx = X(:,1) ;
oldXvals = X(:,2) ;
% Set a new spacing from 0 to 1 and interpolate
newPcntValsx = 0:2:100;
newXvals = interp1(oldPcntValsx, oldXvals, newPcntValsx);
newX = newXvals(:);
% Make original data
oldPcntValsy = X(:,1) ;
oldYvals = X(:,3) ;
% Set a new spacing from 0 to 1 and interpolate
newPcntValsy = 0:2:100;
newYvals = interp1(oldPcntValsy, oldYvals, newPcntValsy);
newY =newYvals(:);
% Make original data
oldPcntValsz = X(:,1) ;
oldZvals = X(:,4) ;
% Set a new spacing from 0 to 1 and interpolate
newPcntValsz = 0:2:100;
newZvals = interp1(oldPcntValsz, oldZvals, newPcntValsz);
newZ = newZvals(:);
N2 = [newX,newY,newZ];

採用された回答

Dana
Dana 2020 年 9 月 8 日
You're interpolating based on the gridpoints located in column J of your Excel file. Each gridpoint must be unique (i.e., different from every other gridpoint), but J188 = J189. That's why you're getting an error.
  1 件のコメント
arifahazwani AY
arifahazwani AY 2020 年 9 月 8 日
Its workk.! I had go through the data several times but mislook that error.
Thank you very much!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by