Main Content

La traduzione di questa pagina non è aggiornata. Fai clic qui per vedere l'ultima versione in inglese.

Proprietà

Dichiarazione di proprietà, attributi e metodi di accesso

Le proprietà contengono i dati dell’oggetto. Le classi definiscono le stesse proprietà per tutti gli oggetti, ma ogni oggetto può avere valori di dati unici. Gli attributi delle proprietà controllano quali funzioni o metodi possono accedere alla proprietà. È possibile definire funzioni che vengono eseguite ogni volta che vengono impostati o interrogati i valori della proprietà. Le proprietà possono attivare eventi quando il codice accede ai loro valori.

Funzioni

espandi tutto

propertiesClass property names
ispropDetermine if property is defined by object

Convalida dell'attributo del valore numerico

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 (Da R2020b)

Convalida del confronto

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

Convalida del tipo di dati

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

Convalida della dimensione

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

Convalida del membro e dell’intervallo

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

Testo con convalida del significato specifico

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

Classi

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

Argomenti

Definizione delle proprietà e impostazione degli attributi

Convalida delle proprietà

Metodi di accesso alle proprietà

Proprietà dinamiche