Matlab code was changed to some weird encryption when saved: Can I somehow revert this change?
5 views (last 30 days)
Show older comments
I saved some homework I had been working on in class to my dropbox, and when I got home to look at it, the code appears to have been "encrypted", or something strange caused the code to completely change. The first line of code reads
"MATLAB 5.0 MAT-file, Platform: GLNX86, Created on: Wed Jan 19 21:35:37 2005"
at the top of my script, which seems to be the clue as to what happened here. The rest of the script is just a bunch of nonsense. For example a few lines of code read
¿„ð@@Â}=_¾Y@@íuA„*Z@¶í²'^¬Z@šSǶB[@Gþ«Cì[@§C‡cS@¬s\O§†G@ëd½Ðò×5@ Çóˆ<[+Y@×ÓÁHY@Ÿ™™™™ùX@×ÓÁHY@Çóˆ<[+Y@Ê[;‘*êP@
¿„ð@@
¿„ð@@Â}=_¾Y@@íuA„*Z@¶í²'^¬Z@šSǶB[@Gþ«Cì[@§C‡cS@¬s\O§†G@ëd½Ðò×5@ Ê[;‘*êP@Çóˆ<[+Y@×ÓÁHY@Ÿ™™™™ùX@×ÓÁHY@Çóˆ<[+Y@Ê[;‘*êP@
I'm not sure how this happened. It was obviously unintentional, and I would like to know if there is a way to reverse whatever happened here.
Note that I was working on a school computer, so retrieving history in matlab won't work as the computers "forget" everything after logging off. So any other suggestions are appreciated. Otherwise I'm going to have to redo several days of works :(
0 Comments
Answers (2)
Walter Roberson
on 10 Dec 2015
Unfortunately, instead of copying your .m file, you used "save". "save" saves a copy of the current workspace to the named file. If you take the file and "load" it then you might see something useful in it, but probably your source is not there and is possibly not recoverable (it would depend on how the school computer is configured.)
2 Comments
Stephen23
on 10 Dec 2015
Andrew's "Answer" moved here:
Hmmm. Yea, load didn't work. Oh well, thanks for replying.
Walter Roberson
on 10 Dec 2015
load('YourFileName.m', '-mat')
With the .m filename it would assume text, but -mat forces it to examine it as a save file.
See Also
Categories
Find more on Scope Variables and Generate Names in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!