Does this mean the file is corrupted?

4 visualizzazioni (ultimi 30 giorni)
MLP
MLP il 30 Apr 2021
Commentato: MLP il 30 Apr 2021
Just came back to work on my code and found that several functions files open to these type of characters... is there a way to recover the actual code or are they completely lost? Why does this happen? If the files are lost I wouldn't like to lose a week's worth of work again.
  2 Commenti
Rik
Rik il 30 Apr 2021
The only alternative I can think of is that your file was encoded with ANSI, but now the editor thinks it is UTF-8. You can try opening these files in Notepad++ and see if messing with the encoding gets you closer to your original file.
And how to prevent this? Regular backups. There is a common wisdom that anything without a backup is not important. The absolute best practice is to have backups to 2 different off-site places (e.g. cloud storage), preferably on different continents and in different formats.
As to why this might have happened: it is impossible to tell from your description. We don't know your OS, your hardware, or even your Matlab version (other than that it is at least R2006a, since you can't change the editor colors in the way you did prior to that). Even if you did provide that information I couldn't tell you, because it isn't my area of expertise.
Walter Roberson
Walter Roberson il 30 Apr 2021
utf8 vs ascii would not explain the above. All us-ascii characters up to ~ (127) have exactly the same representation in utf8.

Accedi per commentare.

Risposte (1)

Walter Roberson
Walter Roberson il 30 Apr 2021
Unfortunately your file is very likely gone. Check for asv files but don't be surprised if none are there.
I do not see any Magic Numbers that hint what the file might be now.
Does the character string NSpïžzè mean anything to you?
  1 Commento
MLP
MLP il 30 Apr 2021
Does not dound familiar. I have never had this happened to me before, the only difference is that I am working from a folder located on an external hard drive where I got software installed that I use when working on different computers, so there is some plug/unplug going on. Although this matlab function was the only one affected, the main program and other functions are OK.

Accedi per commentare.

Categorie

Scopri di più su Software Development Tools in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by