行列をナンバリングして作成する
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
madhan ravi
am 19 Nov. 2023
Bearbeitet: madhan ravi
am 19 Nov. 2023
p = perms(-1 : 2 : 1);
c = num2cell(p, 2);
celldisp(c)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!