Expression Type Functions
Use the following functions to identify the data type of an expression:
• IsArray(x)—Returns 1 if x is a vector or matrix. Returns 0 otherwise.
• IsFunction(x)—Returns 1 if x is a function. Returns 0 otherwise.
• IsScalar(x)—Returns 1 if x is a real or complex scalar. Returns 0 otherwise.
• IsString(x)—Returns 1 if x is a string. Returns 0 otherwise.
• SIUnitsOf(x)—Returns the dimension (magnitude and unit) of the unit of x scaled to the default SI unit, regardless of your chosen unit system. Returns 1 if x has no units.
Arguments
• x is any valid PTC Mathcad expression.
• For SIUnitsOf, x must be real.
Additional Information
• Divide a value by the
SIUnitsOf function to make it unitless, scaled in SI. This function is most useful for stripping then reapplying units to arguments and results for functions that will not accept units, such as
polyfit,
genfit, or the ODE solvers.
• The IsScalar, IsString, and IsArray functions are most useful inside the conditional statement of a program.
• IsNaN is most useful in conditionally handling missing values in data sets.