fix a center of gravity loop
Informazioni
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Mostra commenti meno recenti
imshow(matrix(:,:,1))
%identify axes
[x, y] = ginput(2);
% preallocate matrices
cog = zeros(size(matrix,3),1);
% the loop does not work and the error in the cog(i) line
% loop start
for i = 1:size(matrix,3)
I = matrix(:,:,i);
test = improfile(I,[x(1) x(2)],[y(1) y(2)]);
%the error comes from this line
cog(i) = sum((1:length(test)).*test)/sum(test);
% loop end
end
scog = (cog - min(cog)) / (max(cog) - min(cog));
1 Commento
Matt J
il 27 Lug 2022
You need to demonstrate the code and show us the error messages.
Risposta accettata
Più risposte (0)
Questa domanda è chiusa.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!