Error using matlab.int​ernal.grap​h.construc​tFromEdgeL​ist (line 249) Weight must have as many elements as edge list or be a scalar.

16 ビュー (過去 30 日間)
lol
lol 2021 年 11 月 10 日
コメント済み: lol 2021 年 11 月 13 日
%THIS IS MY CODE:
filename = 'TABLA_AF1.xlsx';
s = xlsread(filename,'A2:A25');
t = xlsread(filename,'B2:B25');
weights = xlsread(filename,'C2:C25');
G = graph(s,t,weights);
p = plot(G,'EdgeLabel',G.Edges.Weight);
[T,pred] = minspantree(G);
highlight(p,T)
And the file Tabla_AF1.xlsx, contains this 3 rows:
Nodo Inicial Nodo Final Distancia
A B 2
A E 16
A C 3
C F 3
C I 12
F E 7
F I 9
F H 6
I H 14
E H 2
E G 4
B E 8
B D 11
D E 2
D G 5
D J 7
G J 1
G L 6
H G 3
J L 12
H L 17
I K 7
H K 9
K L 17
How can I fix it??? please
  3 件のコメント
Walter Roberson
Walter Roberson 2021 年 11 月 10 日
https://www.mathworks.com/matlabcentral/answers/333163-error-when-running-g-graph-s-t-in-matlab#comment_1826524
has the solution.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeNetworks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by