How to fix the error 'Adjacency matrix must be square'?
14 views (last 30 days)
Show older comments
karthikeyan Reddy Thoomu
on 28 Jul 2017
Commented: Walter Roberson
on 29 Jul 2017
I was working with following code to plot and it shows the error 'Adjacency matrix must be square'
clear all
close all
clc
K=[0 0 0 0 1 , 0 0 0 0 2 , 0 0 0 0 3, 0 0 0 0 4 , 0 0 0 0 5 , 0 0 0 0 0];
nodes= ['A', 'B' , 'C' , 'D' , 'E' , 'F'];
G = digraph(K,nodes);
plot(G,'Layout','circle')
title('STAR TOPOLOGY')
0 Comments
Accepted Answer
Walter Roberson
on 28 Jul 2017
In your assignment to K, change the commas into semi-colon
K=[0 0 0 0 1 ; 0 0 0 0 2 ; 0 0 0 0 3; 0 0 0 0 4 ; 0 0 0 0 5 ; 0 0 0 0 0];
2 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!