drive space exist and not able to save txt file

조회 수: 2 (최근 30일)
omnia
omnia 2024년 4월 25일
댓글: Dyuman Joshi 2024년 4월 25일
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

답변 (1개)

Gayatri
Gayatri 2024년 4월 25일
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!

카테고리

Help CenterFile Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by