Error using griddedInterpolant. The grid vectors must contain unique points

1 vue (au cours des 30 derniers jours)
I get the error "Error using griddedInterpolant. The grid vectors must contain unique points"
My script is:
%interpolating modelled at observed depth
for j = 1:length(time_obs)
T_subsurf_mod(:,j) = interp1(depth_act(:,j),T_ice(:,j),depth_obs(:,j));
end
T_subsurf_mod and depth_obs are both 11x8784 double and depth_act is a 201x8784 double.
I have tried using the function "unique" on my input but does not work.
  1 commentaire
Adam
Adam le 3 Mai 2017
Well, the error message is pretty explicit and seeing your code doesn't really help us with that in any way! What do you mean by using unique 'doesn't work'?

Connectez-vous pour commenter.

Réponse acceptée

Harsh
Harsh le 11 Mai 2017
Hello Nina,
If you still need help with this, please contact MathWorks Technical Support here: https://www.mathworks.com/support/contact_us/
Please be sure to provide a detailed description of the issue and attach any relevant files / code / examples required to investigate the issue.
  3 commentaires
Justin Miron
Justin Miron le 22 Juin 2017
Would you be able to tell us how you solved it? I'm getting the same issue.
Walter Roberson
Walter Roberson le 22 Juin 2017
Justin, what happened when you used code along the lines of what I suggested?

Connectez-vous pour commenter.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 11 Mai 2017
%interpolating modelled at observed depth
for j = 1:length(time_obs)
[~, uidx] = unique(depth_act(:,j));
T_subsurf_mod(:,j) = interp1( depth_act(uidx,j), T_ice(uidx,j), depth_obs(:,j) );
end
  2 commentaires
Danielle Su
Danielle Su le 13 Juil 2017
Did that work for u?
Walter Roberson
Walter Roberson le 13 Juil 2017
Well it worked for me, but I wrote it ;-)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by