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.

 採用された回答

Tina
Tina 2022 年 1 月 19 日

0 投票

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Numeric Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by