I searched but could not find online documentation on how to slice a numpy array and cut down its dimension to do the following suggestion of exercise2. That is, get xt with shape (nx, m) from x with shape (nx, m, Tx). Any suggestion?
Here try to run and understand this piece of code:
code
import numpy as np
matrix = np.array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
Slicing rows
Get the first row
row_1 = matrix[0, :]
print(row_1)
Slicing columns
Get the second column
col_2 = matrix[:, 1]
print(col_2)
1 Like
Thanks. I can solve it now.
1 Like