Can corrupted m-files be fixed?

16 次查看(过去 30 天)
I have recovered some of my m-files after formatting my partitions.
But sadly, found them corrupted. Is there anyway to fix them?
Thanks.
Edited: The code becomes like the attached image.
  10 个评论
Walter Roberson
Walter Roberson 2017-7-28
Can you attach one of the m files for us to examine?
Ezz El-din Abdullah
@Rik Wisselink, unfortunately Notepad++ does NOT solve the problem.
@Walter Roberson, I think it can't be retrieved.
Thank you all.

请先登录,再进行评论。

采纳的回答

Jan
Jan 2017-7-28
No. If any byte has been lost in an M or MAT file, the contents is destroyed and cannot be recreated with a 100% reliability. If the files have been lost due to a crashed hard disk, I would not even trust in files which look fine on first view. To control this, I store an MD5 checksum in each of my M-files.
The solution is to restore the files from the last backup. All changes since the last backup are lost. If you do not have a backup: Sorry. There is no magic way to reinvent the destroyed data. It is hard, but the general rule is:
All files without a current backup are not important.
Sometimes professional services can save data from crashed hard disks. This costs about 500 to 1500 US$ and the success is not guaranteed.
  2 个评论
Ezz El-din Abdullah
I wonder how I can make a backup?
Do you mean intuitively to save my files into other place? like in the cloud.
Steven Lord
Steven Lord 2017-7-28
One quick way to make a backup, as Rik Wisselink suggested, is to copy your files to Dropbox, Google Drive, etc. or even to a USB key periodically.
You could use MATLAB Drive Connector to upload your files to MATLAB Drive.
If you're using release R2014b or later, a more sophisticated way to back up your code (and allow you to go back to any previous version you've checked in) would be to use the source control integration functionality included in MATLAB to make a Subversion or Git repository.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Source Control Integration 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by