This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

matlab.mixin.SetGet class

Package: matlab.mixin

Provide handle classes with set and get methods

Description

Use the matlab.mixin.SetGet class to derive classes that inherit set and get methods that behave like the MATLAB® graphics set and get functions.

The set and get methods inherited from matlab.mixin.SetGet support inexact property name matching. You can use a combination of partial and case-insensitive names as long as the inexact name is not ambiguous.

In contrast, dot-based property references require exact property name matches. To implement exact name matching with set and get methods, use the matlab.mixin.SetGetExactNames class.

The matlab.mixin.SetGet class is a handle class.

Class Attributes

Abstract

true

HandleCompatible

true

For information on class attributes, see Class Attributes.

Methods

expand all

Examples

collapse all

Define a class that derives from matlab.mixin.SetGet and has two properties

classdef PropSetGet < matlab.mixin.SetGet
   properties
      Number {mustBeNumeric} 
      Str string
   end
end

Create an instance of the class and use the inherited set method to set a property value.

p = PropSetGet;
set(p,'Number',8)
p.Number
ans =

     8

Introduced in R2014b