How do I create an empty memmapfile object?
1 回表示 (過去 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!