I've created a simulink block that stores data selected from a dbc file using a uitree. The data selected from the uitree is then stored in the block. My problem is that when the dbc file is loaded, it takes 10-15 seconds for the uitree to fully populate, which is fine for the first time the tree is created, but would be relatively inconvenient if there are multiple of these blocks, especially because my simulink model could potentially require over a dozen of these blocks. Having to recreate the uitree a dozen times, 15 seconds each time, would waste a decent chunk of time.
Little more background on how the code currently runs:
My custom made block is dropped into the simulink model. The user clicks on the block. The block calls a matlab script. This script then prompts the user with a uigetfile to select a dbc. The matlab script then collects data from the dbc file and populates the uitree with it. The uitree could have a hundred nodes, each potentially with 2-40 subnodes, which is why it takes so long to generate. The current issue is this would have to happen for every single custom block in the model.
Is there a way to cache the uitree, or some way that simulink/matlab could remember the uitree the first time it is loaded from a particular dbc file? This way, the next time a block attempts to open the it, it only takes a few seconds to open the tree that was previously generated, instead of completely recreating the uitree multiple times?
Thank you