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 />

d = m.Data;<br />

Writeallzerostothecopy:<br />

d(2).x(1:5,1:8) = 0;<br />

d(2).x<br />

ans =<br />

0 0 0 0 0 0 0 0<br />

0 0 0 0 0 0 0 0<br />

0 0 0 0 0 0 0 0<br />

0 0 0 0 0 0 0 0<br />

0 0 0 0 0 0 0 0<br />

Verify that the data in the mapped file has not changed even though the copy<br />

of m.Data(2).x has been written with zeros:<br />

m.Data(2).x<br />

ans =<br />

35330 4902 31861 16877 23791 61500 52748 16841<br />

51314 58795 16860 43523 8957 5182 16864 60110<br />

18415 16871 59373 61001 52007 16875 26374 28570<br />

16783 4356 52847 53977 16858 38427 16067 33318<br />

65372 48883 53612 16861 18882 39824 61529 16869<br />

Invalid Syntax for Writing to Mapped Memory<br />

Although you can expand the dimensions of a typical <strong>MATLAB</strong> array by<br />

assigning outside its current dimensions, this does not apply to the Data<br />

property of a memmapfile object. The following operation is invalid if m.Data<br />

has only 100 elements:<br />

m.Data(120) = x;<br />

Ifyouneedtoexpandthesizeofthemappeddataregion,firstextendthemap<br />

by updating the Format or Repeat property of the memmapfile object to reflect<br />

the new structure of the data in the mapped file.<br />

6-66

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

Saved successfully!

Ooh no, something went wrong!