Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Can I extract a "sub-handle" to just part of the data in a memmapfile object?

조회 수: 1 (최근 30일)
Dan K
Dan K 2012년 6월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi, I've got a type of data file that I'm using that is structured to incorporate several different types of related data in one file. The basic structure of the file is:
header (1024 bytes, this includes the numbers of bytes for each of the folowing parts)
summaryData1
summaryData2
rawDataStream1
rawDataStream2
To give a sense of it, the raw datastreams are likely to be up to 256MB each
I'm constructing my memmapfile object like this (yes, this is part of a classdef file too):
mapstruct = cell(nItemsToMap,3);
% Map the results packets
for iChan = 1:obj.nChan
mapstruct{iChan,1} = 'uint32';
mapstruct{iChan,2} = [nWords(iChan), 1];
mapstruct{iChan,3} = ['Chan' num2str(iChan)];
end
if nDRAM > 0 % There is also DRAM data embedded
obj.DRAM_Pts = obj.DRAM_Bytes/4;
nWords = obj.DRAM_Bytes/2;
for iBoard = 1:nDRAM
iChan = obj.nChan+iBoard;
mapstruct{iChan,1} = 'uint16';
mapstruct{iChan,2} = [nWords(iBoard), 1];
mapstruct{iChan,3} = ['DRAM' num2str(iBoard)];
end
end
% Actually map the file
obj.hFile = memmapfile(S,...
'Offset', memmapStart,...
'Format',mapstruct ...
);
So I end up with obj.hFile. If I want to access DRAM2, I can do so with obj.hFile.data.DRAM2;
What I want to know is if there is a way (without unmapping the whole file) to create a handle to the portion of the file containing just DRAM2, so that I can treat the handle as the variable itself.
Thanks, Dan

답변 (0개)

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by