Nov-12-2019, 11:20 AM
Thanks for the answer
Nevertheless it highlights that I'm still not familiar with some aspects as one can see in my code (still trying to figure out)
Nevertheless it highlights that I'm still not familiar with some aspects as one can see in my code (still trying to figure out)
mat = np.zeros((2,3,3)) mat[0,:,:] = np.eye(3) mat[1,:,:] = 2*np.eye(3) print(mat) ### using locals/globals #for i in range(1,4): # my_var = 'mat{}'.format(i) # locals()[my_var] = i*mat # print("mat{} = {}".format(i, locals()[my_var])) ## using a list names = [] for i in range(1,4): my_var = 'mat{}'.format(i) names.append(my_var) print("names[{}] = {}".format(i-1,names[i-1])) names[i-1] = i * mat print("type(name) = {}".format(type(names))) print("type(name[0]) = {}".format(type(names[0])))Paul