After searching, I found a solution to the problem, which I have copied from the original problem here.
------------------------------------------
I understand that you are getting an error when saving 'MLX' files in MATLAB R2022a and R2022b.
This is a known issue with MATLAB R2022 releases. Currently, these are the following workarounds other than downgrading the Linux kernel:
1) Change the temp directory of MATLAB to a new folder
The default temp directory of MATLAB on Linux is '/tmp/', to resolve the issue, you can create a new folder in a different file directory and set it as the new temp directory.
Please refer to the following example to change the temp directory of MATLAB in the MATLAB Command Window:
ThemeCopy
>> clear all
>> tempdir % ans = '/tmp/'
>> setenv('TMPDIR', 'FILE DIRECTORY FOR THE NEW FOLDER')
>> clear all
>> tempdir % ans = 'FILE DIRECTORY FOR THE NEW FOLDER'
You should be able to save all MLAPP files/ Simulink models/ Live Scripts as usual after changing to the new temp directory.
If the above workaround does not resolve the issue, try to
2) Use MATLAB Online:
MATLAB Online provides access to the latest version of MATLAB from a standard web browser using MathWorks-hosted computing resources and storage, which allows you to continue working with your previous files and related datasets.
Please refer to the following link to upload the files to MATLAB Online and download files from it: https://www.mathworks.com/help/releases/R2022b/matlab/matlab_env/access-files-in-matlab-online.html
If you would like to know more about what is MATLAB Online, please refer to the link below: https://www.mathworks.com/help/releases/R2022b/matlab/matlab_env/what-is-matlab-online.html