필터 지우기
필터 지우기

Can't append variables to large .mat files?

조회 수: 1 (최근 30일)
Christopher
Christopher 2014년 12월 7일
답변: Mohammad Abouali 2014년 12월 8일
I am using R2013b. I have the code:
save(savefilename, 'newP_hist', 'newO_hist', 'newE_hist', 'newt_hist');
save(savefilename, 'newLa_hist', 'newSm_hist', 'newYb_hist', '-append');
save(savefilename, 'newU238_hist', 'newU235_hist', 'newTh_hist', 'newRa_hist', 'newPa_hist', '-append');
where newP_hist, newO_hist, etc. are 840000x120 full matrices. The above code works correctly until it, apparently, tries to save the last variable 'newPa_hist' and I get the error "Error using save, can't write file...'. The resulting file, with the final variable missing, is about 4.37 GB. However, if I do not append the variables and just save the whole thing as:
save(savefilename, 'newP_hist', 'newO_hist', 'newE_hist', 'newt_hist', 'newLa_hist', 'newSm_hist', 'newYb_hist', 'newU238_hist', 'newU235_hist', 'newTh_hist', 'newRa_hist', 'newPa_hist')
Then it works. It also works if I change the order of what is saved in the original code, until the last variable is attempted to write. Whatever the last variable is, it will fail to append. However, it will be written if all the variables are included in one non-appending save command.
So, is matlab unable to append variables to files larger than ~4 GB? Or am I missing something else?
Thanks
  댓글 수: 1
Jan
Jan 2014년 12월 7일
Are you using teh -v7 or the -v7.3 format? See the "MAT-File" settings in the preferences.

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

채택된 답변

Mohammad Abouali
Mohammad Abouali 2014년 12월 8일
Refer to save() command. Scroll down to version. Most possibly you need to pass the version as v7.3.
It is possible that when you gradually append the variables, at the beginning the file is less than 2GB and it decides to use the v7 and once it gets big it can not write. But once you add all the variable at once, it knows that it gonna be a big file and then chooses the right version.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Variables에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by