Live script: Error Loading

129 Ansichten (letzte 30 Tage)
Toke Frederiksen
Toke Frederiksen am 17 Mai 2017
Kommentiert: DGM am 6 Sep. 2024
Hi I have created a matlab livescript file, and saved it as .mlx . When i now try to open the file i get the error:
Error Loading "path to file"
I have tried opening it in a text editor, but it is just empty, though the file is 219 kb. What can I do?
  2 Kommentare
pablo Jaramillo
pablo Jaramillo am 15 Jan. 2021
I tried @Ben Harris approach, but unfortunately did not work. While trying to opening the livescript in 7 zip, it wen to matlab and showed the same error.
Luckily, this file was in my OneDrive folder so I could restore a previous version safely from the files options. I guess Google drive, dropbox and others have the same option..
Adam Danz
Adam Danz am 23 Mai 2021
To add another data point, I fixed the problem by replacing a corrupted image file.
After unzipping the mlx file, the embedded image are stored in a folder named "media" and one of the images were missing (image3). I had a copy of the image, renamed it "image3.gif", and added it to the folder.

Melden Sie sich an, um zu kommentieren.

Antworten (4)

James Johnson
James Johnson am 15 Feb. 2020
One workaround I found is to do a file comparison. Create an empy .mlx file and compare it to the one that MATLAB failed to handle properly. Then you can "merge" the code into the empty file. In my case MATLAB was able to do the diff just not load the file with the plots and prints statements. They should really have an option to load a Live Script WITHOUT the plotting etc.
In my situation the live script hung, returning control of MATLAB to me but nonetheless indicating it was still running and not displaying anything. I closed MATLAB using the "exit" command and restarted MATLAB, but the file wouldn't load. MATLAB just showed the loading wheel and eventually displayed an uninformative error message. I think the problem was something with the display buffer since my code was printing thousands of warnings and was plotting things on top of one another. I added "drawnow" after every plot. Silenced the warning, and put pause(0.1) at the end of every section.
  3 Kommentare
Horace
Horace am 5 Sep. 2024
I can't open mlx file with 7zip, could you tell me which software is used to open it
DGM
DGM am 6 Sep. 2024
A .mlx file is literally just a .zip file full of XML and content files. If it can't be unzipped, then the archive is damaged somehow. Does that mean that there's recoverable data hidden somewhere? Not necessarily. It could likely be a zero-byte file, or something similarly incomplete, caused by a truncated write. Without seeing the file, there's no way for us to guess what is or isn't left of a damaged file, how it got that way, or whether it can be fixed.
Do you have backups? Are there older hidden temp copies of the file still lingering in the directory?

Melden Sie sich an, um zu kommentieren.


Ben Harris
Ben Harris am 27 Apr. 2020
I have been able to recover from a broken Live Script. Basically, my live script file was corrupted from an abnormal termination of MATLAB. When I tried to load the live script, I was able to see my live script code to pop up, but after the code displayed, I got the "Error Loading ...." popup.
Here was the fix.
This was how I diagnosed the problem. I opened up the live script (the mlx file) with unzip from the command prompt. The mlx file acted like a zip file as far as unzip cared. A directory tree was created. In the "matlab" subdirectory. I saw the output.xml file was enormous and likely corrupt.
This is how I fixed my corrupted mlx file. I created a blank mlx file in MATLAB. Then I used 7 zip to open up the blank mlx file, and copy the contents of its output.xml file. So I had the "fresh" output ready to paste on the clipboard. I then again used 7 zip to open up my corrupted mlx file and I edited its output.xml. I did a "select all" in the editor and replaced it with the fresh output.from the clipboard. I saved it. 7 zip asked me to confirm if I was sure I wanted to update the archive and I said yes. And voila, I was able to open the corrupted mlx file.
Now here's the rub: I had to fix what the live script was doing before I ran it again. The corruption of the output.xml occured because of the abnormal termination of MATLAB. That happened because I pushed the limits of an ODE solver too far and it was generating so many error messages that the link between the UI and the backend of MATLAB got detached. That is why I suspect MATLAB hung. So I did not want another such hang. I had to loosen the tolerance I was using in the ODE solver.
  6 Kommentare
SAIKRISHNA
SAIKRISHNA am 13 Aug. 2024
Hello,
I'm facing the same problem as Wu Yu-Wei mentioined above.
Coud'nt open with 7-zip. How to fix this.
Horace
Horace am 5 Sep. 2024
I can't open mlx file with 7zip, could you tell me which software is used to open it

Melden Sie sich an, um zu kommentieren.


Dimitris Iliou
Dimitris Iliou am 19 Mai 2017
I think the reason you are getting this error is possibly because the .mlx file becomes corrupted.
One thing I can suggest is using the 'Previous Versions' feature of Windows (if you can do that), in order to get a previous non-corrupted version of the file.
  2 Kommentare
Ben Harris
Ben Harris am 27 Apr. 2020
Thank you for that important clue. I didn't have prior versions. But I was able to go into the mlx file with 7 zip and fix it. I submitted the fix description.
Eliza Sikorska
Eliza Sikorska am 6 Mai 2022
Thank you so much!

Melden Sie sich an, um zu kommentieren.


Otto Hofstätter
Otto Hofstätter am 14 Dez. 2017
I solved the problem by opening the script with an older Matlab Version (2016). I copied the content to a normal script - and i leave the live script behind.

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by