sum between row in matrix
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
FARAHIDA HANIM MAUSOR
le 19 Jan 2022
Commenté : FARAHIDA HANIM MAUSOR
le 20 Jan 2022
for i = 1 : graph.n
for j = 1: graph.n
graph.n=10'
graph.edges = zeros( graph.n , graph.n );
A = data.cent(i,:)-data.cent(j,:);
graph.edges(i,j) = sqrt(sum(A));
end
end
hi this is my code. I want to calculate the distance between each object in a matrix data.cent by using SUM function. but keep getting
Not enough input arguments. error
can anyone help me with this? thanks.
0 commentaires
Réponse acceptée
Tina
le 19 Jan 2022
Try using this
for i = 1 : graph.n
for j = 1: graph.n
graph.n=10'
graph.edges = zeros( graph.n , graph.n );
A(i,:) = data.cent(i,:)-data.cent(j,:);
graph.edges(i,j) = sqrt(sum(A(:,i)));
end
end
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical 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!