「:」の役割について
6 views (last 30 days)
Show older comments
何を質問しているのかわからないかもしれませんが質問させてください。
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 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!