Please help me with this error!
이전 댓글 표시
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!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Object Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
