Matlab Figure Display taking forever to load

28 views (last 30 days)
Jason
Jason on 16 Dec 2021
Answered: Simar on 6 Mar 2024
Hi There - Plotting in matlab is taking an excruiatingly long time. The problem is seen regardless if I'm calling plot, imagesc, surf etc. For example:
figure; % Figure window pops up within a second
plot(1,10); %Plot takes > 10 seconds to load the data into the figure
I am currently running R2021b. Java Heap memory is set to 2,014mb. I had similar issues on R2019b.

Answers (1)

Simar
Simar on 6 Mar 2024
Hi Jason,
I understand that you are experiencing significant delays while executing plotting functions in MATLAB, regardless of specific plotting command used.
The problem suggests that there might be underlying issues not directly related to the plotting functions themselves. Here are several strategies to diagnose and potentially speed up the plotting:
1. Update Graphics Drivers: Outdated or incompatible graphics drivers can lead to performance issues with MATLAB's plotting functions, which rely on computer's graphics hardware for rendering.
2. Reduce Graphics Complexity: If plots are very complex (e.g., plotting very large datasets or using a lot of graphical annotations), try simplifying them. For example, plot a subset of your data or use the plot function's “Marker” option sparingly. While this might not solve the underlying performance issue, it can help identify if the complexity of the plots is a contributing factor.
3. Check for Background Processes: Make sure there are no intensive background processes running that could be consuming significant CPU or GPU resources, leaving less available for MATLAB.
4. MATLAB Preferences and Java Heap Space: As mentioned increasing Java Heap Memory can improve performance for operations that require more memory, setting it too high can sometimes have adverse effects, as it reduces the memory available to the rest of MATLAB and system. Try adjusting the Java Heap Memory to different values to see if it affects performance. Consider resetting MATLAB's preferences by renaming or deleting the preferences directory (located at matlabroot\toolbox\local), as corrupted preferences can sometimes cause issues.
5. Hardware Acceleration Issues: MATLAB uses hardware acceleration for rendering graphics. There could be compatibility issues with your hardware. Try switching the rendering method MATLAB uses:
  • Open MATLAB and type “opengl info” in the Command Window to see the current OpenGL status.
  • If hardware acceleration is on, try switching to software OpenGL to see if it improves performance: Type “opengl” software in the Command Window and try plotting again.
  • Note: This change will last for the current MATLAB session. To make it permanent, one needs to create a “startup.m” file in MATLAB directory with the command opengl software;.
Performance issues can be challenging to diagnose due to the number of potential contributing factors, including hardware, software configurations, and the specific operations being performed. These steps can help narrow down the cause and potentially lead to a solution.
Please refer to the following links:
Hope it helps!
Best Regards,
Simar

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!