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

isscalar()

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



Keywords: macros, general, variables
isscalar(arg) returns True or False, depending on whether arg is a
scalar, that is a REAL, LOGICAL, or CHARACTER variable all of whose
dimensions are 1.  If arg is undefined, isscalar() returns False.

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

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

isscalar(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 scalar with the properties, if any,
specified by keyword phrases.

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

Examples:
  Cmd> isscalar(1,matrix(PI,1), run(5),"hello",F)
has value vector(T,T,F,T,T)

In a macro
  if (!isscalar($1,logic:T)){error("$1 not T or F")}
would check that argument 1 is a LOGICAL scalar.

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


Gary Oehlert 2003-01-15