How to accelerate the update of visible UITree Nodes
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi guys,
When importing data into a UITree using callback functions, the functions execute perfectly, but it takes the tree quite a while to display its nodes in the GUI afterwards. Is there a way to accelerate the drawing of the UITree, or to at least get a callback like finishedUpdating() ?
Thanks
Edit:
I would still be happy if someone could answer this. It seems like internal problem to save "big" amounts on data within uiTree nodes. Appearantly there is some sort of ultra-inefficient memory reservation algorithm working in the back of an uiTree, which makes updating just HORRIBLY slow.
Im talking about >5 minutes in some cases, where Im just adding 40 nodes with 2kB each.
Edit:
I figured out that its the conversion from matlab to java arrays which kills it.
javaValue(j,k) = java.lang.Double(matlabValue(j,k));
When storing large matrices, this thing turns 1 million of calls into 60 seconds of runtime. Seems like there is no way out of it.
1 Kommentar
Petr Kryze
am 29 Feb. 2024
+1 Would be happy to have an answer for this. GUI updates of uitree are also super slow in my app, even though the code in the callback runs just fine.
Antworten (1)
Amanda Irving
am 9 Aug. 2019
Maho,
Can you give a code example of how the uitreenodes are created and what relationship they have with the 2kB of data? Also, what release of MATLAB are you using?
Here are some ideas of what you can do to help get the uitree view to update as the tree is being built:
1. Create all first level nodes first (before deeper levels of the hierarchy) so the nodes that the end user will most likely see appears in the uitree first.
2. Use drawnow to force incremental updates to the view so that the end user is not waiting for all nodes to be created before the view updates. For example, if the uitree is only tall enough to show 10 notes, create 10 nodes, call drawnow, then continue building the rest of the tree.
t = uitree();
for x = 1:10
uitreenode(t, "Text", "Node" + x);
end
drawnow;
for x = 11:100
uitreenode(t, "Text", "Node" + x);
end
3. If you have a uitree with a very deep hierarchy, you can choose to create nodes dynamically when the end user expands a node. That way, the deep hierarchy is only being built if the person using the tree is browsing that area. The NodeExpandedFcn provides a way to specify a callback for the node expanded event.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!