Subscripts

The element in row i and column j of A is denoted by S(i,j). For example, A(4,2) is the number in the fourth row and second column. For our magic square, S(4,2) is 15. So it is possible to compute the sum of the elements in the fourth column of S by typing
S(1,4)	+ S(2,4) + S(3,4) + S(4,4)
This produces

ans =

34.

but is not the most elegant way of summing a single column.

It is also possible to refer to the elements of a matrix with a single subscript, S(k). This is the usual way of referencing row and column vectors. But it can also apply to a fully two-dimensional matrix, in which case the array is regarded as one long column vector formed from the columns of the original matrix. So, for our magic square, S(8) is another way of referring to the value 15 stored in S(4,2).

NOTE:  If  you try to use the value of an element outside the matrix , it is an error

                temp = S(5,5)
                            !--error 21
        invalid index

On the other hand, if you store a value in an element outside of the matrix, the size increases to accommodate the newcomer:

            temp =  S;

            temp(4,5) =  71

This produces

            temp =

            ! 16. 3. 2. 13. 0.   !
            ! 5. 10. 11. 8. 0.   !
            ! 9. 6. 7. 12. 0.     !
            ! 4. 15. 14. 1. 71. !