Matlab suddenly has issues with plot manipulation (like rotation) as well as adding paths
Show older comments
Up until ten days or so, my Matlab 2021a was working fine. I am regularly plotting some FEM meshes in 3d, and I know I was able to (up until a week or two) normally manipulate figures, i.e. to rotate/zoom/move etc. As I save a lot of those, I noticed that even figures up to 1GB in size would be doable, in a sense that they might be a bit slow/clunky but fast enough to see a mesh from all sides in a reasonable amount of time.
Now, opening a 5-30 MB figures completely breaks everything. Matlab becomes unusually slow, e.g. rotation is extremely slow and once I click anywhere inside the plot it takes 10-20 seconds to get any kind of response from the figure, let alone the rotation you wanted to make with your pointer. At that time everything within Matlab freezes up completely. I'm essentially opening the same figures on which I've worked on a week or two ago, and a figure of this size (the exact same one) was not exhibiting any slow behaviour then. This of course also happens with figures my code outputs.
Moreover, I have a script which is essentially 30-40 calls of the "addpath Some_Path". Up until now, it was executed in a negligible amount of time, whereas now it takes 4-5 seconds for the same calls. I know these issues seem unrelated at first, however I just wanted to to point out they appeared at the same time.
I'm running MATLAB on Windows 10 (now 11 after updating it today) , I have 16 GB of RAM and a i7-1185G7 processor. I want to emphasize again, that this is a sudden change, and I have not modified anything regarding Matlab or Windows at the time when these issues began to appear. I have very little software installed on this system and the laptop itself is almost new, so I'm certain that nothing else is "taking RAM away" from Matlab. I noticed that right at the startup, Task Manager shows Matlab occupying almost 2GB RAM, which seems a bit excessive. (I haven't modified/created any startup scripts)
What I've tried so far:
- Reistalling MATLAB
- Updating to 2021b (from 2021a)
- Updating Windows as well as switching to Windows 11 as of today
- Checking Java heap memory (default value, 1152MB)
None of these have helped so far.
8 Comments
"Moreover, I have a script which is essentially 30-40 calls of the "addpath Some_Path"."
Using the MATLAB search path to access data files is not recommended, not required, and generally inefficient.
"I know these issues seem unrelated at first, however I just wanted to to point out they appeared at the same time."
A hunch based on many threads on this forum: your search path includes either cloud/server locations or folders with large numbers of files in them, which are slowing down MATLAB... because of bad code design which manipulates the search path to access data files (and so forces MATLAB to continuously scan the added folders).
Solution: better code design using absolute/relative filenames to access data files.
DBoss
on 21 Mar 2022
@DBoss: even local folders can slow down MATLAB, if the number of files is large:
How many MATLAB files do you have?
How many data files do you have?
Are they kept strictly in separate folders?
Do you have any cloud services on your computer or any that you directly access: OneDrive, etc. ?
"The only things inside the subfolders are .m scripts."
You write scripts for code of that complexity?
DBoss
on 21 Mar 2022
@DBoss: okay, then we move onto the next tact: what changed 10 days ago?:
- changes to your MATLAB code
- app updates
- OS changes
- network changes
- ... ?
You wrote that "I have not modified anything regarding Matlab or Windows at the time when these issues began to appear", but unfortunately changes are sometimes automatic or seem unrelated (e.g. new serives by the OS, etc.)
Do you have backups/code versioning? Can you do a diff between the code before and after?
DBoss
on 21 Mar 2022
Stephen23
on 21 Mar 2022
" but even without me running any of my code, these problems persist"
Ah, that is interesting.
"...for the people around me, on startup of Matlab, the task manager reserves 700-900MB of RAM, whereas for me a fresh startup of Matlab will appear with nearly 2GB of RAM"
Do you have a STARTUP file or MATLABRC file or anything else that runs when MATLAB starts?
Contact TMW technical support, they can probably help with this kind of issue easier than the volunteers here:
DBoss
on 21 Mar 2022
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown 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!