行列をナンバリングして作成する
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
madhan ravi
el 19 de Nov. de 2023
Editada: madhan ravi
el 19 de Nov. de 2023
p = perms(-1 : 2 : 1);
c = num2cell(p, 2);
celldisp(c)
0 comentarios
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!