drive space exist and not able to save txt file

1 view (last 30 days)
Hi all.
I am running a for loop to generate binary file and save it as .txt file to be used later (305MB each file). Suddenly, at some point in the loop the output files becomes empty with zero byte (although in matlab the data exist). I thought it was due to space on the drive and I empty around 200G from the drive. when continuing the loop, one file only is written with size of 305MB and then all zero again. At that point I am unable to save any change to my .m file too.
Any help

Answers (1)

Gayatri
Gayatri on 25 Apr 2024
Hi Omnia,
Here are several potential causes and troubleshooting steps you can take:
  • Ensure you are correctly closing file handles after writing. MATLAB has a limit on the number of file handles that can be open at any given time. If you open a file with "fopen" and forget to close it with "fclose", you can run out of available file handles which could cause subsequent file operations to fail.
  • If you're using "fprintf" or a similar function to write text files and encounter issues, consider using MATLAB's "save" function to save variables directly in the MAT format which might be more robust and efficient for large data sets.
  • MATLAB itself might have entered an unstable state. Restarting MATLAB can resolve issues related to its internal state.
Please refer the below documentation for save function: https://www.mathworks.com/help/matlab/ref/save.html
I hope it helps!

Community Treasure Hunt

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

Start Hunting!