Clear Filters
Clear Filters

Content of Live Scripts on Ubuntu keeps getting deleted

3 views (last 30 days)
Hi everyone!
I'm using MatLab on Ubuntu. I am writing most of my reports on live scripts and exporting them as PDFs. Very often when I'm mid work, MatLab freezes for a second, and the editor of the live script goes gray (this doesn't happen to .m files). The only way I can see contents of the live script I'm working on is to close it from the editor, and open it again. However, when I open the file, it is blank, and all the progress I've done is lost.
I would really appriciate if there is a solution to this, and I am interested if somebody else has the same problem?

Answers (2)

Walter Roberson
Walter Roberson on 10 Nov 2021
Do you have some kind of cron job that is cleaning out the /tmp ?
Execution of Live Scripts involves extracting the matlab source code from the binary represention of the Live Script file, and then eval() the extracted MATLAB code. The files are extracted into a subdirectory of the MATLAB temporary directory that you can find using
tempdir()
For example at the moment on my Mac, the Livescript files go into /private/var/folders/vg/8pxp_0ps5lb0998xc85797tw0000gn/T/Editor_wlcib/ which is the Editor_wlcib subdirectory of what tempdir() shows
If something on your system is cleaning out the temporary directory, then you could have problems.

Sai Sumanth Korthiwada
Sai Sumanth Korthiwada on 1 Nov 2022
Hello Riste,
I understand that Live Editor is freezing in Ubuntu when exporting live scripts to PDFs.
The following workarounds could be useful when exporting:
  1. export/save to HTML rather than PDF. If PDF is required, then you can save/print the generated HTML to PDF.
  2. save the live script as a ‘.m’ file and then use the publish command to save to PDF.
This issue might be due to MATLAB not having sufficient memory available to perform the exports repeatedly.
You can also try removing 'clear' or 'close' commands in the Live Script, as these impact performance as well. For example, these functions:
>> clear all
>> close all
may cause performance issues if called repeatedly.
Hope this resolves your issue.

Categories

Find more on File Operations in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!