property::hasprop

Does an object have properties?

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

property::hasprop(object)
property::hasprop()

Description

property::hasprop(object) tests, whether the object has properties and returns TRUE if the object or any subexpression has a property, otherwise FALSE.

Compared with getprop, property::hasprop is a fast function and can be used to determine, whether an object has properties without using the slower functions getprop or is.

Note

In some cases, the function is can derive some aspects without any defined property (see Example 2)!

Examples

Example 1

Does the expression 2*(x+1) have any properties?

property::hasprop(2*(x + 1))

assume(x > 0):
property::hasprop(2*(x + 1))

getprop(2*(x + 1))

delete x:

Example 2

property::hasprop returns FALSE, but is can determine an answer unequal to UNKNOWN:

property::hasprop(0 < x/(x + y) + y/(x + y))

is(exp(x) = 0)

Parameters

object

Any MuPAD® object

Return Values

TRUE or FALSE

See Also

MuPAD Functions