how to generate code ?

1 次查看(过去 30 天)
ankanna
ankanna 2021-3-21
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

回答(1 个)

Walter Roberson
Walter Roberson 2021-3-21
  9 个评论
ankanna
ankanna 2021-4-25
allpaths is not taking directly matlab
Walter Roberson
Walter Roberson 2021-4-25
As I posted "This requires R2021a."
You are using R2016a.
You should consider updating your MATLAB.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品


版本

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by