Error using griddedInterpolant. The grid vectors must contain unique points
古いコメントを表示
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
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'?
採用された回答
その他の回答 (1 件)
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
2 件のコメント
Danielle Su
2017 年 7 月 13 日
Did that work for u?
Walter Roberson
2017 年 7 月 13 日
Well it worked for me, but I wrote it ;-)
カテゴリ
ヘルプ センター および File Exchange で Interpolation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!