LoginSignup
0
0

More than 1 year has passed since last update.

Python matrix m行n列成分を取り出したい

Posted at

リストの場合

m = [[10, 20], [30, 40]]
print(m[0][1])
20

matrix クラスを使用する場合

NG

import numpy as np
m = [[10, 20], [30, 40]]
mat = np.matrix(m)
mat[0][1]
IndexError: index 1 is out of bounds for axis 0 with size 1

OK

import numpy as np
m = [[10, 20], [30, 40]]
mat = np.matrix(m)
mat[0].A1[1]
20

参考記事

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0