How to increase memory efficiency with App Designer and huge amount of generated data?
32 views (last 30 days)
Show older comments
I created a quite simple UIFigure. It contains just a few buttons and two UIAxes. The mlapp contains a formula which calculates some data and the Axes are used to compare different iterations of the result. For simliicty here, lets assume that I want to compare different sets of rand(1,300000) - so, kind of huge data here. These has to be in the axes in-detail, because I want to zoom in and spot the differences. Sadly, the app reacts slow, so zoom via mouse input is not very comfortable. Internally, I store the data as propperties (Access = private) to process it further. That makes up to 3 copies of the data within the app: one in each axes and in the defined variables from the private properties. Is there a better way to store/process the data to make the behaviour of the mlapp a bit smoother? (Reduce the redundancy as well as a better way to use the created data within different parts of the UI.)
Edit: for a better understanding I attached a stripped app which explains the current data storage/handling
1 Comment
collin bannister
on 21 Aug 2024 at 14:25
Hello Simon,
Sounds like a lot of data, I might recommend using matlab for what its good at, instead of viewing the differences, as the tool itterates, Maybe you could create a section of code that will loop through the array, identify the differences for you, and if the difference is significant enough, pause the loop for you to view the difference. adding a continue button to itterate the rest of the loop.
I think for any application, 300000 values is a lot, Another thought , you could consider simplifying the array, such that code will itterate through your arrays comparing All data and assign 1 to a new array if the "difference" is great enough and a 0 where it is negligable. Then pass through the array of 1s to view each difference.
It is hard to give too much insight without knowing more about the difference comparison you are making. is this two 300,000 arrays comparing values across directly? or is it more complecated. Hope this gives you some ideas.
Answers (1)
Walter Roberson
on 21 Aug 2024 at 17:30
Moved: Walter Roberson
on 21 Aug 2024 at 17:30
It is not possible to visualize 300000 points in a single axes, in the sense that graphics windows are probably at most 7680 × 4320 so at maximum width, you would be plotting about
300000/7680
points per pixel -- and realistically probably about twice that as you probably do not have an 8k UHD.
It is a waste to send 300000 points to a graphics object that isn't going to be able to render it. It makes more sense to filter down the points first before plotting.
If you are zooming in on the axes, then it can make sense to hook into the graphics pre-zoom callback in order to change the points to be plotted -- sending only a window-width of points to the graphics routines and having the callback automatically swap a different window of points upon the zoom or pan.
0 Comments
See Also
Categories
Find more on Data Distribution Plots 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!