Next: keyvalue() Up: MacAnova Help File Previous: isstruc()   Contents


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

Keywords: macros, general, variables
isvector(arg) returns True or False, depending on whether arg is a
vector of any type, REAL, LOGICAL or CHARACTER.  A matrix or array is
considered to be a vector by isvector() if all dimensions except the
first have length 1.  In particular, if arg is a scalar, isvector(arg)
returns True, while if arg is a row vector (dimensions 1,m with m > 1),
isvector(arg) returns False.  If arg is undefined, isvector(arg) returns

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

isvector(arg, integer:T), isvector(arg, positive:T), isvector(arg,
negative:T) and isvector(arg, nonneg:T) are similar, testing that arg is
a REAL vector 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.

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

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

  Cmd> isvector(7, vector(x), matrix(x,5), array(x,5,1,1), matrix(x,1))
has value vector(T,T,T,T,F) if x has 5 elements.

In a macro
        error("$1 is not a CHARACTER vector")}
would check that argument 1 is a CHARACTER vector.

See also topics 'vectors', 'macros', isarray(), ischar(), isdefined(),
isfactor(), isfunction(), isgraph(), islogic(), ismacro(), ismatrix(),
isname(), isnull(), isnumber(), isreal(), isscalar(), isstruc().

Gary Oehlert 2003-01-15