0

In MATLAB, I can create an array and assign values to it dynamically without mentioning the size of the array while its creation. I'm new to MATLAB, the following show how I create an array and assign values to it in MATLAB.

>> a=[]
a = 
     []

>> a(2,2) = 55
a = 
     0   0
     0   55

We can write a function in Python to do this but I want to know that is there any equivalent procedure to MATLAB functionality of assigning values to array dynamically in Python or in Numpy?

Srivishnu
  • 759
  • 1
  • 6
  • 15
  • 1
    That's a bad way of assigning values in MATLAB. Changing the size of an array is not a good idea – Sardar Usama Jun 11 '17 at 06:41
  • 1
    and https://stackoverflow.com/questions/42041016/struggling-with-dynamics-ndarray; MATLAB grows the matrix by creating a new one with each assignment. It's not the same as `Python` list `append`. – hpaulj Jun 11 '17 at 07:37

0 Answers0