How do I create an empty memmapfile object?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dan K
am 20 Feb. 2012
Bearbeitet: dpb
am 18 Okt. 2013
I am trying to figure out how to create an empty memmapfile object. My situation is this: I have a loop where I'm finding the files associated with a project and creating a memory map of each one. That memory map, along with various other information is returned in a structure, which becomes part of a structure array. I've had a problem where occasionally one of the files fails in the processing, and then the whole system comes crashing to a halt because I'm trying to map dissimilar types of structures into the structure array (because the new one doesn't have a valid memmapfile).
What I want to do is to be able to define a default structure that will be returned in the event of a failed file load, but then I need to include a memmapfile object in the returned structure. I don't want to try to memmap a meaningless file, because I suspect that Matlab would really not like it if I mapped the same dummy file multiple times. So what would be the equivalent of:
dummy = memmapfile(0) ?
Is it to use the metaclass(memmapfile)? I wouldn't think so, but I really don't understand metaclasses at all.
Thanks, Dan
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 20 Feb. 2012
MATLAB did not complain when I memmapfile('/dev/null') 1000 times. The MS Windows equivalent would be 'NUL:' as the file name.
Note that either of these would be completely empty, so you would encounter problems as soon as you attempted to use the data in the empty file. But that's a design issue, as you did not define what you wanted to have happen in such a case.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!