Programming Fundamentals - The MathWorks - #501

/ 840


catalogue search
P. 501
P. 502
P. 503
P. 504
P. 505
P. 506
P. 507
P. 508
P. 509
P. 510
P. 511
P. 512
P. 513
P. 514
P. 515
P. 516
P. 517
P. 518
P. 519
P. 520
P. 521
P. 522
P. 523
P. 524
P. 525
P. 526
P. 527
P. 528
P. 529
P. 530
P. 531
P. 532
P. 533
P. 534
P. 535
P. 536
P. 537
P. 538
P. 539
P. 540
P. 541
P. 542
P. 543
P. 544
P. 545
P. 546
P. 547
P. 548
P. 549
P. 550


See other catalogues for The MathWorks

Text version of the page
Accessing Files with Memory-Mopping
Note To successfully modily the lile you are mapping to. you must have write permission for tloil file. I f you do not. have write permission, you can still set the Writable property to true, but attempting Lo write to the file generates
You can change the value of the Writable properly at any time. To make the memory map to records. dat read only, type:
m.Writable = false; Property names, like Writable, are not case sensitive.
Reading a Mapped File
The most commonly used property of the memmapf ile class is the Data property, l! is through this property of the memory-map object that MATLAB provides all read and write access to the contents of the mapped file.
The actual mapping of a file to the MAT LAI! address space does not take place when you construct a memmapf ile object. A memory map, based on the information currently stored in the mapped object, is generated the first time you reference or modify the Data property for that object.
After you map a file to memory, you can read the contents of that file using the same MATLAB statements used to read variables from the MATLAB workspace. By accessing the Data property of the memory map object, the contents of the mapped file appear as if they were an array in the currently active workspace. You simply index into this array lo read the desired data from the file.
This section envoi's the following' topics:
• "Improving Performance" on page 6-44
• "Example 1 — Reading a Single Data Type" on page 6-44
" "Example 2 — Formatting File Data as a Matrix" on page 6-45
• "Example 3 — Reading Multiple Data Types" on page 6-46
6-43

pageCatalog pdf di En 2012-06-22-01