Programming |
Methods of the memmapfile Class
You can use the following methods on objects constructed from the memmapfile
class.
Using the disp Method
Use the disp
method to display all properties of a memmapfile
object. The text displayed includes only the property value, and not the object name or the MATLAB response string, ans =
.
Show all properties for object m
:
disp(m) Filename: 'd:\matlab\mfiles\records.dat' Writable: false Offset: 2048 Format: {'int16' [2 2] 'model' 'uint32' [1 1] 'serialno' 'single' [1 3] 'expenses'} Repeat: Inf Data: 753x1 struct array with fields: model serialno expenses
Using the get Method
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'
You can also choose to use the objname.property
syntax:
To return the values for all properties with get
, pass just the object name:
get(m) Filename: 'd:\matlab\mfiles\records.dat' Writable: 0 Offset: 2048 Format: {3x3 cell} Repeat: Inf Data: [753x1 struct]
Writing to a Mapped File | Deleting a Memory Map |
© 1994-2005 The MathWorks, Inc.