Creating a memory mapped file
조회 수: 10 (최근 30일)
이전 댓글 표시
I am trying to create a new memory-mapped 'big data' file by using sequential writes of structured binary data, where I write a vector of values for each variable separately. First, can I start with an empty file that I have opened for write? I cannot seem to write an array into mapped location unless data already exists at that location. See below
%%define the memory map for the output binary file
OutFile = 'testOutFile';
fid = fopen('test.lls','w');
mmLLS = memmapfile('test.lls',...
'Format',{ ...
'single' 1 'lat'; ...
'single' 1 'lon'},...
'Repeat',1,'Writable',true);
Lat = single(32.3);
Lon = single(-110.2);
mmLLS.Data.lat = Lat;
Error using memmapfile/subsasgn (line 732)
A subscripting operation on the Data field attempted to create a
comma-separated list. The memmapfile class does not support the use
of comma-separated lists when subscripting.
댓글 수: 1
per isakson
2016년 8월 31일
편집: per isakson
2016년 8월 31일
"First, can I start with an empty file that I have opened for write?"   The short answer is NO!
Doc says: "Memory-mapping is a mechanism that maps a portion of a [existing] file, or an entire [existing] file, on disk to a range of addresses within an application's address space."
채택된 답변
Walter Roberson
2016년 9월 1일
"memmapfile does not expand or append to a mapped file. Use instead standard file I/O functions like fopen and fwrite."
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Large Files and Big Data에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!