Main Content

Eigenschaften

Eigenschaftserklärung, Attribute und Zugriffsmethoden

Eigenschaften enthalten Objektdaten. Klassen definieren dieselben Eigenschaften für alle Objekte, aber jedes Objekt kann einzigartige Datenwerte aufweisen. Eigenschaftsattribute kontrollieren, welche Funktionen oder Methoden auf die Eigenschaft zugreifen dürfen. Sie können Funktionen definieren, die ausgeführt werden, wenn Sie Eigenschaftswerte einstellen oder abfragen. Eigenschaften können Ereignisse auslösen, wenn der Code auf deren Werte zugreift.

Funktionen

alle erweitern

propertiesClass property names
ispropDetermine if property is defined by object

Validierung von numerischen Wertattributen

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

Validierung von Vergleichen

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

Validierung von Datentypen

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

Größenvalidierung

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

Validierung von Zugehörigkeit und Bereich

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

Validierung von Text mit spezieller Bedeutung

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

Klassen

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

Themen

Definieren von Eigenschaften und Einrichten von Attributen

Eigenschaftsvalidierung

Methoden für Zugriff auf Eigenschaften

Dynamische Eigenschaften