Info

This question is closed. Reopen it to edit or answer.

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

1 view (last 30 days)
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

Answers (0)

Community Treasure Hunt

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

Start Hunting!