Next: ismissing() Up: MacAnova Help File Previous: ismacro()   Contents

ismatrix()

Usage:
ismatrix(arg1 [,arg2, ...] [,real:T, logic:T, char:T, integer:T,\
  positive:T, negative:T, nonneg:T])



Keywords: macros, general, variables
ismatrix(arg) returns True if arg is a matrix of any type, REAL,
LOGICAL, or CHARACTER, and False otherwise.  For arg to be considered a
matrix it is not necessary that ndims(args) be 2, just that no more than
two dimensions have length greater than 1.  In particular, a scalar or a
vector is considered to be a matrix by ismatrix().  If arg is undefined,
ismatrix() returns False.

ismatrix(arg,real:T) returns True if and only if arg is a REAL matrix.
Similarly ismatrix(arg,char:T) and ismatrix(arg,logic:T) return True
only if arg is a matrix of the specified type.  You can specify more
than one acceptable type; for example, ismatrix(arg,real:T,logic:T)
returns True only if arg is a REAL or LOGICAL matrix.

ismatrix(arg, integer:T), ismatrix(arg, positive:T), ismatrix(arg,
negative:T) and ismatrix(arg, nonneg:T) are similar, testing that arg is
a REAL matrix whose value has the specified property.  You can use
'integer:T' with any of 'positive:T', 'negative:T' and 'nonneg:T'.  You
cannot use 'char:T' or 'logic:T' with these keywords.

ismatrix(arg1, arg2, ..., argk [,keywords]) returns a LOGICAL matrix,
each element of which is True or False depending on whether or not the
corresponding argument is a matrix with the properties, if any,
specified by keyword phrases.

The principal use of ismatrix() is in checking the arguments of a macro
for appropriateness.  See also argvalue() for another way to check for
the properties of macro arguments.

Examples:
  Cmd> ismatrix(vector(x), matrix(x,4), array(x,4,1,2), array(x,2,2,2))
      has value vector(T,T,T,F) when x has 8 elements.

   if (!ismatrix($1,real:T)){error("$1 is not a REAL matrix")}
     in a macro would check argument 1 is a REAL matrix.

See also topics 'matrices', error(), isarray(), ischar(), isdefined(),
isfactor(), isfunction(), isgraph(), islogic(), ismacro(), isname(),
isnull(), isnumber(), isreal(), isscalar(), isstruc(), isvector().


Gary Oehlert 2003-01-15