Live script: Error Loading
조회 수: 215(최근 30일)
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?
James Johnson 2020년 2월 15일
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.
Ben Harris 2020년 4월 27일
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.
Dimitris Iliou 2017년 5월 19일
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.