Struct as mask input
显示 更早的评论
Hello, I would like to have a struct as a mask input to a Model Reference. I will have multiple identical model references in my model. When I currently try to modify the mask parameter to use a struct, I get the following error:
"Variable 'blah' has ben deleted from the base workspace."
The struct contains information for a large number of blocks and I am trying to have the blocks extract the information from the struct in the normal way (e.g., Block param: blah.field.block_param_value).
Everything works if I have the struct defined in the base workspace and then have the sub-model (used by the model reference) use that directly. However, this does not allow me to use multiple identical model references because they would all point to the same struct in the base workspace.
I have looked at a number of other posted questions asking about this issue and have read that this is possible but without in-depth information as to how.
The following asks this but the answer does not work for me-
This references it but was never answered-
Other resources suggest using a non-virtual bus, but I am unsure how that accomplishes this goal if I'd like to access the fields in a struct-like fashion.
Very much appreciate the help ahead of time :)
4 个评论
Paul
2024-1-6
Hi Prestonr,
I'd like to make sure I understand the problem.
Let's say we have a model called child.slx. child.slx contains, let's say, two blocks. Each block has one block parameter, and the parameter in the dialog for the first block is blah.field.value1 and the parameter in the dialog for the second block is blah.field.value2, where blah is a struct.
The goal is to be able to have child.slx be referenced (more than once) from a top model, let's call it parent.slx. And we want each instance of child.slx to get its own struct input passed down from parent, i.e., blah1 and blah2, such that the field values of blah1 and blah2 are used as the block parameters child1 and child2 respectively.
Is that correct?
Prestonr
2024-1-6
Paul
2024-1-6
Is masking the Model block a requirement?
Prestonr
2024-1-6
采纳的回答
更多回答(1 个)
madhan ravi
2024-1-6
0 个投票
Use one of the approaches mentioned in the link:
类别
在 帮助中心 和 File Exchange 中查找有关 Interactive Model Editing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!