23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6 Data Import and Export<br />

ans =<br />

166x1 struct array with fields:<br />

x<br />

y<br />

Examine one structure in the array to show the format of each field:<br />

d(3)<br />

ans =<br />

x: [5x8 uint16]<br />

y: [4x5 double]<br />

Now read the x and y fields of that structure from the file. <strong>MATLAB</strong> formats<br />

the first block of data as a 5-by-8 matrix of uint16, asspecifiedintheFormat<br />

property, and the second block as a 4-by-5 matrix of double:<br />

d(3).x<br />

ans =<br />

34432 47500 19145 16868 38165 47956 35550 16853<br />

60654 51944 16874 47166 35397 58072 16850 56576<br />

51075 16876 12471 34369 8341 16853 44509 57652<br />

16863 16453 6666 11480 16869 58695 36217 5932<br />

57883 15551 41755 16874 37774 31693 54813 16865<br />

d(3).y<br />

ans =<br />

1.0e+009 *<br />

3.1229 1.5909 2.9831 2.2445 1.1659<br />

1.3284 3.0182 2.6685 3.7802 1.0837<br />

3.6013 2.3475 3.4137 0.7428 3.7613<br />

2.4399 1.9107 4.1096 4.2080 3.1667<br />

Example 4 — Modifying Map Parameters<br />

This example plots the Fourier transform output of data read from a file via a<br />

memory map. It then modifies several parameters of the existing map, reads<br />

from a different part of the data file, and plots a histogram from that data.<br />

Create a memory-mapped object, mapping 1,000 elements of type double<br />

starting at the 1025th byte:<br />

6-58

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

Saved successfully!

Ooh no, something went wrong!