Error using digraph/subsref
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
economics student
il 11 Set 2017
Modificato: Walter Roberson
il 12 Set 2017
Hi, I have tried to use digraph on a Matlab2016 version.
However the result is: Error using digraph/subsref Method 'subsref' is not defined for class 'digraph' or is removed from MATLAB's search path.
Error in name of program (line 117) plot(G,'Layout','force','EdgeLabel',G.Edges.Weight,'markersize',20)
Warning: Function subsasgn has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.
thanks
2 Commenti
Walter Roberson
il 11 Set 2017
Please show us the output of
which plot
I suspect you have created a variable named "plot"
Stephen23
il 12 Set 2017
Please show us the output of these commands:
which plot -all
which subsasgn -all
Risposta accettata
Guillaume
il 11 Set 2017
Modificato: Guillaume
il 11 Set 2017
Is there actually a Weight column in your edge table? If you haven't specified a weight of any edge, the Weight column is never created.
I can easily reproduce a similar error in R2017a if the graph does not have weights for the edges. In R2017a, the error message is a bit more detailed:
>> G = digraph([1 1], [2 3]);
>> plot(G,'Layout','force','EdgeLabel',G.Edges.Weight,'markersize',20)
Error using digraph/subsref (line 27)
Unrecognized variable name 'Weight'.
>> G.Edges
ans =
2×1 table
EndNodes
________
1 2
1 3
However,
>> G = digraph([1 1], [2 3], [5 3])
>> plot(G,'Layout','force','EdgeLabel',G.Edges.Weight,'markersize',20)
>> G.Edges
ans =
2×2 table
EndNodes Weight
________ ______
1 2 5
1 3 3
No error
4 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!