How do I create an empty memmapfile object?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2012-2-20
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!