# Easy code help about matrix. How to change the elements in a given matrix?

For example I have a matrix

A[1,1]={1,2,3,4};


Now I want to change the second element of A[1,1] to 5,so my code is

A[1,1][]=5;


but there will be some error messages.
what I want to get is

A[1,1]={1,5,3,4};


What needs to be noted in particular is that the matrix A[1,1] must have double corner mark. Because there are lots of matrix in my actual code, and I should difference them.

I came up a way to settle this. But It's a bit of tedious.

For[n = 1, n <= nt, n = n + 1, For[i = 1, i <= it, i = i + 1, A[n, i] = Array[a[n, i], 4]]]


In this example

a[1,1]=1;a[1,1]=2;a[1,1]=3;a[1,1]=4;
a[1,1]=5;


Then I can get the A[1,1]={1,5,3,4};And I can handle the matrix with any corner mark.

• I don't think it's useful, when working with Mathematica, to think of an expression such as A[1,1]={1,2,3,4}; as defining a matrix. It is, according to Mathematica syntax, the definition of a function called A and the value it takes when passed the arguments 1,1. Perhaps A is a function from the space of 2 integers into the space of lists of integers ? As for what you mean by the phrase corner mark, I don't know. – High Performance Mark Feb 15 '19 at 9:47

A[1, 1] = {1, 2, 3, 4};