Mat for Beginners
Mat (M) is short for matrix. A matrix is another word for an array. An array of variables in this case. An array is a series of variables.
Examples
Mat A would refer to the whole array of A(1) to A(10) (if 10 is the highest item in the array)
each item in the array can contain a different value. for example
- A(1)=10
- A(2)=30
- A(3)=25
- A(4)=40
one thing you can do with a mat statement is refer to the whole array, so if you said PRINT MAT A the system would return
- 10
- 30
- 25
- 40
another thing you can do with a mat statement is change how large the array is MAT A(5) would change the array to have 5 items in it. so after executing MAT A(5) if you did PRINT MAT A you would get
- 10
- 30
- 25
- 40
- 0
(because the 5th item never got set to anything)
you can also use a mat statement to refer to a range within an array, for example PRINT MAT A(2:4) would return
- 30
- 25
- 40
Arrays can be sorted thus changing the order of the items contained within the arrays.
also arrays can have more than one dimension.
- X(1,1)=5
- X(1,2)=10
- X(2,1)=15
- X(2,2)=20
these are best envisioned like a spread sheet... having two numbers to identify which cell a value is contained in.