For use in a Mask, how does one access data from a Structure in the Model Workspace?
조회 수: 5 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!