行列をナンバリングして作成する
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
A=[* * **;* * * 0;* * 0 0]
(*には-1か1が入る)
という行列を作成したいと考えています。
各*は-1か1の2通りであるため、行列Aは2^9=512通りできるのですが、この512通りの行列AをA1,A2,…A512というようにナンバリングして作成する方法を教えていただけたら幸いです。
練習としてB=[**]を作成するためのコードを以下のように作成してみたのですが、行列にナンバリングする方法が分かりませんでした。
for i = -1:2:1
for j=-1:2:1
B=[i j]
end
end
0 commentaires
Réponses (1)
madhan ravi
le 19 Nov 2023
Modifié(e) : madhan ravi
le 19 Nov 2023
p = perms(-1 : 2 : 1);
c = num2cell(p, 2);
celldisp(c)
0 commentaires
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!