how to fix this error 'interp2'
2 ビュー (過去 30 日間)
古いコメントを表示
imshow(matrix(:,:,1))
%identify axes
[x y] = ginput(2);
% preallocate matrices
cog = zeros(size(matrix,3),1);
%cog
% loop start
for i = 1:size(matrix,3)
I = matrix(:,:,i);
n = ceil(norm([diff(x), diff(y)]));
test = interp2(I, linspace(x(1), x(2),n), linspace(y(1), y(2),n));
cog(i) = sum((1:length(test)).*test')/sum(test);
% loop end
end
scog = (cog - min(cog)) / (max(cog) - min(cog));
0 件のコメント
回答 (1 件)
Matt J
2022 年 7 月 28 日
Because your first argument to interp2 is a matrix while the second is a scalar.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!