how to generate code ?

1 回表示 (過去 30 日間)
ankanna
ankanna 2021 年 3 月 21 日
コメント済み: Walter Roberson 2021 年 4 月 25 日
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 日
node = 10;
  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 Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by