Initialize empty matrix in Python

前端 未结 7 1276
旧巷少年郎
旧巷少年郎 2020-12-31 07:56

I am trying to convert a MATLAB code in Python. I don\'t know how to initialize empty matrix in Python.

MATLAB Code:

demod4(1) = [];
<
7条回答
  •  被撕碎了的回忆
    2020-12-31 08:32

    If you want to initialize the matrix with 0s then use the below code

    # for m*n matrix
    matrix = [[0] * m for i in range(n)]
    

提交回复
热议问题