Plotting very large data freeze MATLAB
19 views (last 30 days)
Show older comments
Commented: Walter Roberson on 14 Dec 2018
I have large array 3D data and when I am plotting it using plot and plot3 function MATLAB freezes. Is there any option to create it in leass memory storage
No not really . In current MATLAB the graphics data is sent to another thread for rendering , and the renderer may have to send it to graphics primitives that might hold onto the data (especially 3d since you can get big performance improvements by transmitting data once and then sending rotation information ). So any data will end up being promoted from sparse to full if needed , and will end up being duplicated perhaps more than once. The only space saving that can matter heading through the pipeline is single precision .
Beyond that. .send less data to be plotted . For example if you know some points are going to be hidden then it might be worth not plotting them . Don't worry too much about it if it is complicated to figure out, as the graphics hardware can figure it out more efficiently , but don't be wasteful either And remember that sending data that is denser than the display resolution is probably a waste unless you are deliberately trying to be extremely realistic ...
I have a relatively large display, 2560 x 1440 . Not the largest available, but yours is probably not much larger.
2560 x 1440 = 3686400 .
243528000 / 3686400 = 66.061
So your data is about 66 times larger than can possibly be represented on my display. You would need an array of 8 of my monitors per side to have each pixel of your data show up once.
It is therefore a complete waste to attempt to plot all of the data you have. You should subsample it.
Since it is a 3D finite element mesh, it is probably equally spaced along some directions. You could probably use indexing to choose representative points to plot. You could probably do pixel averaging if you are concerned about every 8th pixel not being representative enough.
If your points are not equally spaced (such as could happen for deformation studies) then you can use griddedInterpolant or scatteredInterpolant to calculate values over a grid no larger than your display.
Remember, it is not required that you plot everything at the same time. It is valid to hook into the zoom callbacks to extract subsets of data according to the current axes limits, and to sub-sample according to display resolution.
Find more on Annotations 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!