Error using griddedInterpolant. The grid vectors must contain unique points

5 次查看(过去 30 天)
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 个评论
Adam
Adam 2017-5-3
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'?

请先登录,再进行评论。

采纳的回答

Harsh
Harsh 2017-5-11
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 个评论

请先登录,再进行评论。

更多回答(1 个)

Walter Roberson
Walter Roberson 2017-5-11
%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

类别

Help CenterFile Exchange 中查找有关 Interpolation of 2-D Selections in 3-D Grids 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by