ํ•„ํ„ฐ ์ง€์šฐ๊ธฐ
ํ•„ํ„ฐ ์ง€์šฐ๊ธฐ

Why does my .mat file keep getting corrupted?? ๐Ÿ˜–

์กฐํšŒ ์ˆ˜: 11 (์ตœ๊ทผ 30์ผ)
Nathan Lively
Nathan Lively 2020๋…„ 11์›” 24์ผ
๋Œ“๊ธ€: Nathan Lively 2021๋…„ 4์›” 20์ผ
At the beginning of my script I load my workspace variables..
load SA_Measurements
At the end of my script I save.
save("SA_Measurements.mat",'Main_Settings','Main_TF','Sub_Settings','Sub_TF','Results','-append');
I can run the script on the same day without problems. If I come back a month later, I get an error about the file being corrupt and it won't load at all or, like today, it will load some of the variables and show this error: Error using load
Cannot read file /Documents/MATLAB/SubAligner/SA_Measurements.mat.
I've been through many forum posts, but can't find a solution. What am I doing wrong??
  ๋Œ“๊ธ€ ์ˆ˜: 5
Jan
Jan 2021๋…„ 4์›” 17์ผ
@Robert Reid: Please post any details, preferrably in a new thread.
Nathan Lively
Nathan Lively 2021๋…„ 4์›” 20์ผ
Hey Robert. Maybe? I have made some changes and have only had the issue once since making the changes.
  1. I changed load SA_Measurements to load('SA_Measurements.mat'). I really don't think that did anything, but I noticed it when I looked up the doc for load.
  2. I changed
save("SA_Measurements.mat",'Main_Settings','Main_TF','Sub_Settings','Sub_TF','Results','-append');
to
save('SA_Measurements.mat','Main_Settings','Main_TF','Sub_Settings','Sub_TF','Results');
The main thing is that I got rid of the -append. I still use it occasionally, but try to avoid it.
I also immediately save a backup of that MAT file on the next line. I have only had to use it once, but was glad it was available.

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

๋‹ต๋ณ€ (0๊ฐœ)

์นดํ…Œ๊ณ ๋ฆฌ

Help Center ๋ฐ File Exchange์—์„œ Whos์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

ํƒœ๊ทธ

์ œํ’ˆ

Community Treasure Hunt

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

Start Hunting!

Translated by