For use in a Mask, how does one access data from a Structure in the Model Workspace?
5 views (last 30 days)
Show older comments
Hi!
In the Model Workspace, I have multiple structures that contain data. These structures contain parameter sets, one structure for each subsystem. In the structures, each line stands for a different variant of the same parameters.
I'd like to have a mask that can access these sets programmatically, like a drop-down menu or similar. If the first entry of the drop-down menu is selected, the parameter set corresponding to the structure's first line is to be chosen, etc.
In the model, I tested a Constant Block with the value set to engines(1).V_M (just one random entry), and it's visible to the model and works.
However, if I do the same in the mask, it returns an error; as if the Model Workspace is not visible to the mask. Is that so?
Putting the struct into the Base Workspace works. The same command as above put into the mask callback code now correctly accesses the desired entry.
I have tried the Simulink.ModelWorkspace object and its command getVariable; it seems to do the job, but only by using additional auxiliary variables. It doesn't seem to be the cleanest approach (correct me if I'm wrong! - also kindly let me know if that approach is bullocks in the first place).
Cheers
0 Comments
Answers (0)
See Also
Categories
Find more on Programmatic Model Editing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!