Main Content

Propiedades

Declaración de propiedades, atributos y métodos de acceso

Las propiedades contienen datos de objetos. Las clases definen las mismas propiedades para todos los objetos, pero cada objeto puede tener valores de datos únicos. Los atributos de las propiedades controlan qué funciones o métodos pueden acceder a la propiedad. Es posible definir funciones que se ejecuten cada vez que se definan o consulten valores de propiedades. Las propiedades pueden activar eventos cuando el código acceda a sus valores.

Funciones

expandir todo

propertiesClass property names
ispropDetermine if property is defined by object

Validación de atributos de valor numérico

mustBePositiveValidate that value is positive
mustBeNonpositiveValidate that value is nonpositive
mustBeNonnegativeValidate that value is nonnegative
mustBeNegativeValidate that value is negative
mustBeFiniteValidate that value is finite
mustBeNonNanValidate that value is not NaN
mustBeNonzeroValidate that value is nonzero
mustBeNonsparseValidate that value is nonsparse
mustBeRealValidate that value is real
mustBeIntegerValidate that value is integer
mustBeNonmissingValidate that value is not missing (desde R2020b)

Validación de la comparación

mustBeGreaterThanValidate that value is greater than another value
mustBeLessThanValidate that value is less than another value
mustBeGreaterThanOrEqualValidate that value is greater than or equal to another value
mustBeLessThanOrEqualValidate that value is less than or equal to another value

Validación del tipo de datos

mustBeAValidate that value comes from one of specified classes (desde R2020b)
mustBeNumericValidate that value is numeric
mustBeNumericOrLogicalValidate that value is numeric or logical
mustBeFloatValidate that value is floating-point array (desde R2020b)
mustBeTextValidate that value is string array, character vector, or cell array of character vectors (desde R2020b)
mustBeTextScalarValidate that value is single piece of text (desde R2020b)
mustBeNonzeroLengthTextValidate that value is text with nonzero length (desde R2020b)
mustBeUnderlyingTypeValidate that value has specified underlying type (desde R2020b)

Validación de tamaño

mustBeNonemptyValidate that value is nonempty
mustBeScalarOrEmptyValidate that value is scalar or empty (desde R2020b)
mustBeVectorValidate that value is vector (desde R2020b)

Validación de miembros y rango

mustBeMemberValidate that value is member of specified set
mustBeInRangeValidate that value is in the specified range (desde R2020b)

Texto con validación de significado especial

mustBeFileValidate that path refers to file (desde R2020b)
mustBeFolderValidate that input path refers to folder (desde R2020b)
mustBeValidVariableNameValidate that input name is valid variable name (desde R2020b)

Clases

dynamicpropsSuperclass for classes that support dynamic properties
meta.DynamicPropertyDescribe dynamic property of MATLAB object
event.DynamicPropertyEventEvent data for dynamic property events
meta.propertyDescribe property of MATLAB class
meta.Validation Describes property validation
meta.FixedDimension Fixed dimension in property size specification
meta.UnrestrictedDimension Unrestricted dimension in property size specification
meta.ArrayDimension Size information for property validation
matlab.lang.OnOffSwitchStateRepresent on and off states with logical values

Temas

Definir propiedades y establecer atributos

Validación de propiedades

Métodos de acceso a propiedades

Propiedades dinámicas