In Python, these 2 lines just assign two different objects to the variable name
.
name= 'matriz%d'%i # assign a string
name= np.zeros((1,5)) # assign an array
Some other languages have a mechanism that lets you use the string as variable name, e.g. $name = ...
. But in Python that is awkward, if not impossible. Instead you should use structures, such as a dictionary.
e.g.
adict = {}
for i in range(3):
name= 'matriz%d'%i
adict[name] = np.zeros((1,5))
You can then access this array via a dictionary reference like: adict['matriz3']
You could also use a list, and access individual arrays by number or list iteration:
alist = [np.zeros((1,5)) for i in range(3)]
for i,A in enumerate(alist): # iteration with index
A[:] = i+np.arange(5)
for a in alist: # simple iteration
print(a)