Both of these methods first convert the matrix to a list, then use min() and max() to find the most
extreme element.
[3.21] Convert matrices to single-row or single-column vectors
It is occasionally necessary to convert a matrix to a row- or column-vector. To convert a matrix to a
column vector, use this:
mat2cvec(m)
Func
©([m]) convert matrix to column vector
©2april01/dburkett@infinet.com
list▶mat(mat▶list(m),1)
EndFunc
Or, to convert a matrix to a row vector, use this:
mat2rvec(m)
Func
©([m]) convert matrix to row vector
©2april01/dburkett@infinet.com
list▶mat(mat▶list(m),1)
EndFunc
mat2cvec() converts a matrix to a row vector by first converting the matrix to a list, then converting that
list to a matrix with one element in each row. mat2rvec() changes a matrix to a row vector in the same
way, except that the column vector is transposed to make it a row vector. For example, if the input
matrix is
m =
abc
def
ghi
then mat2rvec(m) returns [a b c d e f g h i], and mat2cvec(m) returns
a
b
c
d
e
f
g
h
i
3 - 20