Error using 'graph' function in matlab R2019b

조회 수: 2 (최근 30일)
Elie Matar
Elie Matar 2019년 10월 28일
댓글: Ofer Perl 2021년 1월 31일
I have created a binarized symmetric matrix A (n x n) which represents the connectivity matrix with 1's and 0's - 1 representing the existence of an edge. This error though is general and works with any type of matrix. When using the command G=graph(A) I get the following error:
>> G=graph(A)
Error using graph.validateEdgeProperties (line 375)
Edge properties must be a table.
Error in graph/set.EdgeProperties (line 330)
G.EdgeProperties = graph.validateEdgeProperties(T);
Error in graph (line 278)
G.EdgeProperties = table(nonzeros(tril(A)), 'VariableNames', {'Weight'});
I am using R2019b. I have not used the graph function before on this version. What is the problem? It occurs irrespective of the matrix that I am using (it is a generic problem).
Thanks!
  댓글 수: 2
Walter Roberson
Walter Roberson 2019년 10월 28일
What shows up for
which -all table
Elie Matar
Elie Matar 2019년 10월 28일
Hi Walter:
>> which -all table
C:\Program Files\MATLAB\R2019b\toolbox\matlab\datatypes\@table\table.m % table constructor
C:\Program Files\MATLAB\R2019b\toolbox\matlab\bigdata\@tall\table.m % tall method
Thanks!

댓글을 달려면 로그인하십시오.

채택된 답변

Christine Tobler
Christine Tobler 2019년 10월 29일
Could you try starting a new MATLAB and just enter the following code:
>> A = ones(3);
>> G = graph(A);
If this gives the error message you mentioned, could you again run the following lines on command line?
>> T = table(nonzeros(tril(A)), 'VariableNames', {'Weight'})
>> istable(T)
>> class(T)
If this returns true and 'table', we'll have a deeper mystery to solve. If not, please let us know what is being displayed for you.
  댓글 수: 5
Elie Matar
Elie Matar 2019년 10월 29일
That solves it! Thankyou very much for your help. Really appreciated.
Ofer Perl
Ofer Perl 2021년 1월 31일
Christine's solution also worked for me, cheers!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Steven Lord
Steven Lord 2019년 10월 28일
Can you confirm that A is a matrix? What does this show when executed immediately before you try to construct the graph from A?
whos A
If that shows A is a matrix, thinking along the same lines as Walter's idea, do you have your own functions named nonzeros, tril, or istable? Do these commands show versions of these functions other than the ones provided by MATLAB?
which -all nonzeros
which -all tril
which -all istable
  댓글 수: 3
Steven Lord
Steven Lord 2019년 10월 29일
C:\Program Files\MATLAB\spm12\external\fieldtrip\compat\matlablt2013b\istable.m
This is taking precedence over istable function included in MATLAB. If possible rename it, remove it from the MATLAB path, or delete it altogether.
Elie Matar
Elie Matar 2019년 10월 29일
Yes - thank you very much!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by