How to perform arithmetic operation in pdist?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, i need some advice for solving the error of using squareform,
Assignment has more non-singleton rhs dimensions than non-singleton subscripts
Error in mapmulti (line 234)
distAllTier1(i,j) = squareform (pdist([node(j).x - node(i).x] + [node(i).y - node(j).y] ));
And the code as follow:
for i = 1:1:numNodes
for j = indPCHTier1 %indPCHTier1 = 1 3 5 7 13 18 21 = j(7)
if node(i).tier == 1
if i == j
distAllTier1(i,j) = NaN;
else
distAllTier1(i,j) = squareform (pdist([node(j).x - node(i).x] + [node(i).y - node(j).y] ));
end
end
end
end
Thanks :D
3 comentarios
Respuestas (2)
Walter Roberson
el 1 de Oct. de 2018
distAllTier1{i,j} = squareform (pdist([node(j).x - node(i).x] + [node(i).y - node(j).y] ));
4 comentarios
Image Analyst
el 1 de Oct. de 2018
Why not just use pdist2() and not worry about squareform()?
I always use pdist2() and never use pdist().
6 comentarios
Asyran Abdullah
el 2 de Oct. de 2018
Editada: Asyran Abdullah
el 2 de Oct. de 2018
Image Analyst
el 2 de Oct. de 2018
Make it easy to help you. Attach your node variable in a .mat file.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!