how to generate code ?

1 view (last 30 days)
ankanna
ankanna on 21 Mar 2021
Commented: Walter Roberson on 25 Apr 2021
node = 3;
Link = (node-1)*node/2
NN = toeplitz(node+1:-1:2);
mask = logical(fliplr(diag(ones(1,node-1),-1)));
NN(mask) = 1;
for n = 0:2^Link -1
out(:,:,n+1)= bitget(n, NN);
end
output
val(:,:,1) =
0 0 0
0 0 0
0 0 0
val(:,:,2) =
0 0 0
0 0 1
0 1 0
val(:,:,3) =
0 0 1
0 0 0
1 0 0
val(:,:,4) =
0 0 1
0 0 1
1 1 0
val(:,:,5) =
0 1 0
1 0 0
0 0 0
val(:,:,6) =
0 1 0
1 0 1
0 1 0
val(:,:,7) =
0 1 1
1 0 0
1 0 0
val(:,:,8) =
0 1 1
1 0 1
1 1 0
Link = (node-1)*node/2
please help to generate upto n nodes

Answers (1)

Walter Roberson
Walter Roberson on 21 Mar 2021
  9 Comments
ankanna
ankanna on 25 Apr 2021
allpaths is not taking directly matlab
Walter Roberson
Walter Roberson on 25 Apr 2021
As I posted "This requires R2021a."
You are using R2016a.
You should consider updating your MATLAB.

Sign in to comment.

Categories

Find more on Networks in Help Center and File Exchange

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!