get - Object properties

Syntax

get(obj)
out = get(obj)
out = get(obj,'PropertyName')

Arguments

obj

An object or an array of objects.

'PropertyName'

A property name or a cell array of property names.

out

A single property value, a structure of property values, or a cell array of property values.

Description

get(obj) returns all property names and their current values to the command line for obj.

out = get(obj) returns the structure out where each field name is the name of a property of obj, and each field contains the value of that property.

out = get(obj,'PropertyName') returns the value out of the property specified by PropertyName for obj. If PropertyName is replaced by a 1-by-n or n-by-1 cell array of strings containing property names, then get returns a 1-by-n cell array of values to out. If obj is an array of objects, then out will be an m-by-n cell array of property values where m is equal to the length of obj and n is equal to the number of properties specified.

Remarks

When specifying a property name, you can do so without regard to case, and you can make use of property name completion. For example, if jm is a job manager object, then these commands are all valid and return the same result.

out = get(jm,'HostAddress');
out = get(jm,'hostaddress');
out = get(jm,'HostAddr');

Examples

This example illustrates some of the ways you can use get to return property values for the job object j1.

get(j1,'State')
ans =
pending

get(j1,'Name')
ans =
MyJobManager_job

out = get(j1);
out.State
ans =
pending

out.Name
ans =
MyJobManager_job

two_props = {'State' 'Name'};
get(j1, two_props)
ans = 
    'pending'    'MyJobManager_job'

See Also

inspect, set

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS