Please help me with this error!
Afficher commentaires plus anciens
W = [1 4 3 3 9 7 5 10 5 8 6];
a=[1 2 4 2 1 1 1 3 3 4 2];
b=[2 4 6 5 5 4 3 6 4 5 3];
DG = sparse(a,b,W);
% tril returns the lower triangular part of the matrix.
UG = tril(DG + (DG'));
h = view(biograph(UG,[],'ShowArrows','off','ShowWeights','on'));
[dist,path,pred] = graphshortestpath(UG,1,6,'Directed',false);
set(h.Nodes(path),'Color',[1 0.4 0.4])
fowEdges = getedgesbynodeid(h,get(h.Nodes(path),'ID'));
revEdges = getedgesbynodeid(h,get(h.Nodes(fliplr(path)),'ID'));
edges = [fowEdges;revEdges];
set(edges,'LineColor',[1 0 0]);
set(edges,'LineWidth',1.5);
I got the error : Error using +
Matrix dimensions must agree.
Error in tesing (line 10)
UG = tril(DG + (DG'));
Thank you!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Object Analysis dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
