matlab.mixin.SetGet.get - Query specified property values - MATLAB (original) (raw)
Main Content
Class: matlab.mixin.SetGet
Namespace: matlab.mixin
Query specified property values
Syntax
CV = get(H,Name) SV = get(H) get(H)
Description
[CV](#buhmlu4-CV) = get([H](#buhmlu4-H),[Name](#buhmlu4-Name))
returns the values of the named property from the objects in the handle arrayH
. If H
is scalar, get
returns a single value; if H
is an array, get
returns a cell array of property values. get
matches partial and case-insensitive names that are not ambiguous. Inexact name matching applies only to class properties. Dynamic properties require exact name matches.
If you specify a cell array of property names as the second argument, then get
returns a cell array of values, where each row in the cell corresponds to an element in H
and each column in the cell corresponds to an element in the property name cell array.
If H
is nonscalar and Name
is the name of a dynamic property, get
returns a value only if the property exists in all objects referenced in H
.
[SV](#buhmlu4-SV) = get([H](#buhmlu4-H))
returns a structure in which the field names are the object's property names and the values are the current values of the corresponding properties. If H
is nonscalar, then SV
is a numel(H)
-by-1
array of structures.
get([H](#buhmlu4-H))
displays all property names and their current values for the MATLABĀ® objects with handle H
.
Your subclass can override the matlab.mixin.SetGet
getdisp
method to control how MATLAB displays this information.
Input Arguments
Input handle array, specified as a single handle or an array of handles
Property to query, specified as a combination of partial and case-insensitive names. The inexact name must not be ambiguous. Dynamic properties must use exact names.
Data Types: char
| string
Output Arguments
Value of queried property, returned as a single value or a cell array of values.
Structure of property names and values, in which the field names are the object's property names and the values are the current values of the corresponding properties.
Data Types: struct
Examples
Get the value of a property named Data
from an instance of a class derived from matlab.mixin.SetGet
.
propValue = get(obj,'Data');
Tips
- Override the
matlab.mixin.SetGet
class getdisp method to change how MATLAB displays information returned byget
.