save -append problem: long duration to save an existing variable in a big mat-file

조회 수: 7 (최근 30일)
Emmanuel
Emmanuel 2012년 11월 29일
편집: Pritesh Parmar 2025년 4월 17일
Hi all,
I have a very peculiar problem with the save command. I have a lang mat-file (ca. 300 MB, compressed, created with MATLAB > 7). Now I save an additional signal in the file using
save(filename, signalname, '-append');
If the variable signalname doesn't exist in the file the copy process is very fast. But, if the file contains already a variable signalname the whole process takes too long to end (some minutes!!!). If I try to append more variables that already exist in the file, it takes evern more!! Is this a bug? Am I doing something wrong?
Thanks a lot in advance for any advice!
Emmanuel

답변 (3개)

Jan
Jan 2012년 11월 29일
This seems reasonable. Overwriting an existing variable requires to decompress the file at first to remove the old value. The larger the file, the more time is required.
You see the same problem for other compressed files also: ZIP, compressed SSDs, or a large number of books packed in a cardboard box for.

Diderot
Diderot 2014년 5월 15일
I got a similar problem. What's more, the new data file after several variables appended is much larger than the original, even though I only updated the previously existing variables with the same size instead of creating any new variables. This is really confusing. Would anyone share insights? Thanks!
  댓글 수: 1
Jan
Jan 2014년 5월 18일
Please do not append a new question to an existing thread. Note that you cannot accept an answer, if it is not your question and that your message is not an asnwer to the original question. Thanks.

댓글을 달려면 로그인하십시오.


Pritesh Parmar
Pritesh Parmar 2025년 4월 15일
편집: Pritesh Parmar 2025년 4월 17일
I had the same issue with MATLAB's "save -append" with updating variables with large dataset. Try the following code: fastSaveUpdate - Efficiently update variables in MAT-file - File Exchange - MATLAB Central
Pritesh Parmar

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by