| MATLAB® | ![]() |
s = get(obj)
val = get(obj, prop)
s = get(obj) returns the values of all properties of the memmapfile object obj in structure array s. Each property retrieved from the object is represented by a field in the output structure. The name and contents of each field are the same as the name and value of the property it represents.
Note Although property names of a memmapfile object are not case sensitive, field names of the output structure returned by get (named the same as the properties they represent) are case sensitive. |
val = get(obj, prop) returns the value(s) of one or more properties specified by prop. The prop input can be a quoted string or a cell array of quoted strings, each containing a property name. If the latter is true, get returns the property values in a cell array.
You can use the get method of the memmapfile class to return information on any or all of the object's properties. Specify one or more property names to get the values of specific properties.
This example returns the values of the Offset, Repeat, and Format properties for a memmapfile object. Start by constructing the object:
m = memmapfile('records.dat', ...
'Offset', 2048, ...
'Format', { ...
'int16' [2 2] 'model'; ...
'uint32' [1 1] 'serialno'; ...
'single' [1 3] 'expenses'});
Use the get method to return the specified property values in a 1-by-3 cell array m_props:
m_props = get(m, {'Offset', 'Repeat', 'Format'})
m_props =
[2048] [Inf] {3x3 cell}
m_props{3}
ans =
'int16' [1x2 double] 'model'
'uint32' [1x2 double] 'serialno'
'single' [1x2 double] 'expenses'
Another way to return the same information is to use the objname.property syntax:
m_props = {m.Offset, m.Repeat, m.Format}
m_props =
[2048] [Inf] {3x3 cell}
To return the values for all properties with get, pass just the object name:
s = get(m)
Filename: 'd:\matlab\mfiles\records.dat'
Writable: 0
Offset: 2048
Format: {3x3 cell}
Repeat: Inf
Data: [753 1]
To see just the Format field of the returned structure, type
s.Format
ans =
'int16' [1x2 double] 'model'
'uint32' [1x2 double] 'serialno'
'single' [1x2 double] 'expenses'
![]() | get (hgsetget) | get (RandStream) | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |