Error when saving MLX file

Illustration
Agustín - 2022-11-14T10:08:22+00:00
Question: Error when saving MLX file

I am using MATLAB R2022a in Ubuntu 20.04.5 LTS (Kernel 5.15), and whenever I try so save a .m script file I have no issues, however when I try to save a Live Editor file (.mlx), I get the next error:   Unable to save file myFile.mlx   java.lang.RuntimeException: Internal Exception in writing MLX file : Could not commit changes: copy failed: fl:filesystem:SystemError: /tmp/.bdae-ce03-39f3-5965.tmp invalid cross-device link I have tried with R2022b, but the problem persists. I have another Ubuntu station (Kernel 5.4) and it does write the file. I have read about similar errors depending on the Kernel version. Is there any solution that does not include downgrading the Kernel?

Expert Answer

Profile picture of Prashant Kumar Prashant Kumar answered . 2025-11-20

This issue is a known problem with MATLAB R2022 releases on certain Linux kernels. Here are a couple of workarounds that don't involve downgrading your kernel:

  1. Change MATLAB's Temporary Directory: The default temporary directory for MATLAB on Linux is /tmp/, which can cause issues with cross-device links. You can change the temporary directory to a new folder. Here's how you can do it in the MATLAB Command Window:

    matlab
    >> clear all
    >> tempdir % Check the current temp directory
    % ans = '/tmp/'
    >> setenv('TMPDIR', '/path/to/new/tempdir') % Replace with your desired path
    >> clear all
    >> tempdir % Check the new temp directory
    % ans = '/path/to/new/tempdir'
    
  2. Use MATLAB Online: MATLAB Online provides access to MATLAB through a web browser using MathWorks-hosted resources. This can bypass the issue with saving MLX files on your local machine.


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!