|
Contents | Previous | Next | Subchapters |
| Syntax |
[ list of values ] |
{ list of values } | |
| See Also | elements , fill , str2mat |
[ ]) combine matrices that have the same row dimension.
The column dimension of the resulting matrix is the sum of the
widths of the combined matrices.
x = [1, 2, 3]
y = [4, 5]
print [x, y]
O-Matrix will respond
[ 1 , 2 , 3 , 4 , 5 ]
If you enter
x = {[1, 2], [6, 7]}
y = {[3, 4, 5], [8, 9, 10]}
[x, y]
O-Matrix will respond
{
[ 1 , 2 , 3 , 4 , 5 ]
[ 6 , 7 , 8 , 9 , 10 ]
}
{ }) combine matrices that have the same column dimension.
The row dimension of the resulting matrix is the sum of the
heights of the combined matrices.
If the values are character matrices,
they need not have the same column dimension.
The resulting matrix takes on the same width as the widest row.
(Spaces are used to fill in the shorter rows).
x = {1, 2}
y = 3
{x, y}
O-Matrix will respond
{
1
2
3
}
If you enter
x = {[1, 2], [3, 4]}
y = [5, 6]
{x, y}
O-Matrix will respond
{
[ 1 , 2 ]
[ 3 , 4 ]
[ 5 , 6 ]
}
If you enter
x = {"red", "blue"}
print x
O-Matrix will respond
red
blue
Note that the column dimension of x is 4.
Empty Matrices
x = { }
print type(x), rowdim(x), "by", coldim(x), "matrix"
O-Matrix will respond
logical 0 by 0 matrix
If you want to clear the memory reserved for a variable
and guard against its value being used by mistake,
you should use novalue
instead of an empty matrix.
When using the brackets and braces to combine matrices,
it is admissible for some of the matrices to be 0 by 0 matrices.
Such matrices do not add any elements during the combine operation.
If you enter
x = []
y = {1, x, 2}
O-Matrix will respond
{
1
2
}