How can I check if a HDF5 file is already in use?

7 次查看(过去 30 天)
Madam, Sir,
I use the following functions to feed a h5 file :
h5create.m / h5write.m /h5writeatt.m
When writing in it while the file is used by another interface, it gets corrupted and unusable.
Is there a way to check if the file is in use and even close it, in order to write in it again without corrupting it?
Thanks in advance for any feedback and best regards,
Anne Tye
  1 个评论
Mario Malic
Mario Malic 2020-9-28
  • There is a function called fileattrib, but in my case (Windows), it didn't work properly the last time I worked with it.
  • Also, you can try with fopen, when the file is in use, check what is returned when you call the function.
From the documentation
fileID = fopen(filename) opens the file, filename, for binary read access, and returns an integer file identifier equal to or greater than 3. MATLAB® reserves file identifiers 0, 1, and 2 for standard input, standard output (the screen), and standard error, respectively.
If fopen cannot open the file, then fileID is -1.
  • If this interface is some sort of program/process, you can check here

请先登录,再进行评论。

回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by