「:」の役割について
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
何を質問しているのかわからないかもしれませんが質問させてください。
for i = 1:10
A(4,4,i) = [0 0 1 0; 0 0 0 1; 0 0 0 0; 0 0 0 0]
end
このようなコードを書いた場合エラーが起こり
for i = 1:10
A(:,:,i) = [0 0 1 0; 0 0 0 1; 0 0 0 0; 0 0 0 0]
end
このようにするとエラーが起きず問題なく結果が出力されました。
等式の右の行列が4行4列なのでA(4,4,i)でも良いと思ったんですがなぜA(:,:,i)ではないとうまく動かないのでしょうか
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!