MATLAB editor shows files have no contents (blank)
Show older comments
Hello,
When I try to open an m-file or script in the editor, it opens up blank. The file, however, is clearly not empty - I can open it with a generic text editor and the code appears fine. This also happens if I try to create a new script in the editor. The editor opens a new 'untitled' file, but I can not enter any text in the editor.
I am running R2022b on an Apple M1 Max macOS 13.1
thanks
7 Comments
mathieu perton
on 26 Oct 2023
Moved: Dyuman Joshi
on 1 Aug 2024
Same happening in Centos, any matlab version from 2021.
Frederike Petzschner
on 16 Aug 2024
Moved: Rik
on 20 Aug 2024
Same issue on a IMac on three different Matlab Versions (2021, 2022b, 2023a).
Onyly happens for .m filed not .mlx
Files opens fine on a MacBook Air. How can I solve the issue?
MUhammad Awais
on 17 Aug 2024
Moved: Rik
on 20 Aug 2024
Hi
This happens to me when I am trying to open a file from the cloud storage which was not yet fully synced to the mac storage. However, there was not any issue after that (when sync complete and files are locally available; note the cloud sign beneath the file when it is not locally available).
Frederike Petzschner
on 20 Aug 2024
@MUhammad Awais that solved it for me! Thank you!
Jeffrey
on 22 Sep 2025
on Win 10 with R2024a just make sure the script(s) you want to load are on the local drive..not Onedrive, i.e "always keep on this device"
Answers (2)
Dvarkesh Madhu
on 7 Mar 2023
Hi Daniel,
1. Are you trying to open the .m file as a live script?
In that case, save .m as a UTF-8 format, or save it as a live script code(.MLX).
2. Or are you connecting to MATLAB via remote desktop applications? In that case, try starting MATLAB using the "-cefdisablegpu" flag from your system command prompt:
matlab -cefdisablegpu
3. Another thing you can try is to update your graphics driver and see if that resolves the issue.
4. Or start MATLAB using the”-softwareopengl” flag from your system command prompt:
matlab -softwareopengl
If the issue still persists, feel free to contact our Technical Support team for further assistance.
Hope this helps!
3 Comments
Daniel
on 7 Mar 2023
Walter Roberson
on 7 Mar 2023
You cannot update your graphics driver in any recent version of MacOS, except by installing the latest MacOS security patch (if it just happens to have a driver update). Apple moved graphics drivers down a ring in security, and now insists that third-party graphics drivers be bundled in each application rather than being installed system-wide... and MacOS does not provide any separate update process for the system supplied drivers.
It would not be unreasonable to suspect that the intent of the change in driver implementation was to drive Nvidia out of the Mac market. This of course would not be the official rationale, but if you look at the history of the relationship between Nvidia and Apple, with multiple anonymous sources supposedly saying that very high level Apple executives ordered engineering not to approve any new Nvidia drivers...
I have exactly same problem. Very frequently when i open Matlab 2022b (same was for 2021 and 2023a) all previosly open .m files appear blank. The only solution is to quit matlab, delete the ~/Library/Application Support/MathWorks/MATLAB/R2022b and start again. This is very frustrating (especially giving license price of Matlab) looks like a clear Matlab bug (otherwise deleting the R2022b folder would not help)
Also i see same problem is reported here:
Using Macos 13.2.1 on M1 Max
7 Comments
Geoff Martin
on 20 Sep 2023
Moved: Dyuman Joshi
on 1 Aug 2024
Same problem here with R2022b Beta and R2023a on a MacBook Pro (16", 2021, M1) running 13.4.1.
For me, the problem is intermittent. Sometimes, quitting and re-starting solves the issue. Sometimes it helps to wait long enough to get a coffee between quitting and re-starting...
Thanks for the suggestion regarding deleting the ~/Library/... directory. I'll use that next time if I've already gotten a coffee.
MUhammad Awais
on 1 Aug 2024
I am facing the same issue... I switched to mac and now.....
Jorge Moura
on 4 Sep 2024
I am working on a windows 10 machine and have exactly the same problem in R2024a. Both with .m and .mlx files. For me it just happened in this version, previous Matlab versions worked fine in this regard.
I can't find ~/Library/Application Support/MathWorks/MATLAB/R2022b
Sometimes it just takes a long time for the editor window to exit this state and the code to appear, other times just by opening externally the file, and this is not a fix since not always opens the file correctly.
Any new ideas how to correct this bug?


~/Library/Application Support/MathWorks/MATLAB/R2022b is a MacOS specific location. It corresponds to what would be returned by
prefdir()
Murray
on 23 Sep 2024
@Evg 's solution -- delete /Library/Application Support/MathWorks/MATLAB/R2021a (for me) -- worked for me. (And @Jorge Moura advice is good to know -- for when I move to Linux.)
Thank you!
MacBook Air, M1, 2020 running macOS Sonoma 14.6.1
Murray
Meagan
on 16 Oct 2024
In case it is helpful for debugging or for anyone who does not want to remove the entire preferences directory, deleting just the history files in that directory (output from prefdir()) worked for me (R2024b on Mac M1 Pro running Sonoma 14.4.1).
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!