Modifying a memory-mapped data file

1 view (last 30 days)
Ken
Ken on 6 Jan 2018
Answered: Jan on 12 Jan 2018
I am using memmapfile to managed and update structured data records. After I modify a record in the file, the "modified date" of the file is not updated. I do confirm that the record has been modified. Unfortunately, it seems that the memory-mapped file is not updated by by cloud service, presumably because the file "modified date" is not changed.
Does anyone know how this might be fixed/managed?

Answers (2)

Ben Drebing
Ben Drebing on 12 Jan 2018
Unfortunately, this is a current limitation of MATLAB. But a quick way to get around this is to open and close it again after you've modify the file so that the modified time stamp gets updated. You can just do something like:
fileID = fopen('MyFile.dat','w');
fclose(fileID);
This will update the date modified without actually changing the file.
  5 Comments
Walter Roberson
Walter Roberson on 12 Jan 2018
No, 'a+' forces all writes to be at the end of the file. You would need 'a' permission for what you are proposing.

Sign in to comment.


Jan
Jan on 12 Jan 2018
Under Windows you can use https://www.mathworks.com/matlabcentral/fileexchange/24671-filetime to set the modification date manually.

Categories

Find more on Licensing on Cloud Platforms in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!