23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6 Data Import and Export<br />

Data: 16581x1 struct array with fields:<br />

model<br />

serialno<br />

expenses<br />

Using the get Method<br />

You can use the get method of the memmapfile class to return information on<br />

any or all of the object’s properties. Specify one or more property names to<br />

get the values of specific properties.<br />

This example returns the values of the Offset, Repeat, andFormat properties<br />

for a memmapfile object. Use the get method to return the specified property<br />

values in a 1-by-3 cell array, m_props:<br />

m_props = get(m, {'Offset', 'Repeat', 'Format'})<br />

m_props =<br />

[2048] [Inf] {3x3 cell}<br />

m_props{3}<br />

ans =<br />

'int16' [1x2 double] 'model'<br />

'uint32' [1x2 double] 'serialno'<br />

'single' [1x2 double] 'expenses'<br />

You can also choose to use the objname.property syntax:<br />

m_props = {m.Offset, m.Repeat, m.Format}<br />

m_props =<br />

[2048] [Inf] {3x3 cell}<br />

To return the values for all properties with get, pass just the object name:<br />

get(m)<br />

Filename: 'd:\matlab\mfiles\records.dat'<br />

Writable: 0<br />

Offset: 2048<br />

Format: {3x3 cell}<br />

Repeat: Inf<br />

Data: [16581x1 struct]<br />

6-68

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!