Simulink Selector block with parameterised indices in masked Referenced Model
3 次查看(过去 30 天)
显示 更早的评论
In Simulink, I am trying to create a masked Referenced Model 'masked_X' whose input is one element of a single vector of several hundreds of signals. I would like to use a Selector block for this selection, with the Index specified as a field of a structured parameter (i.e. say p.p_index) of the mask. However, I get the following error when running the model:
For dimensions 1, parameter 'Indices' in 'masked_X/Y Selector': invalid setting in 'masked_X/Y Selector' for parameter 'Indices'.
It looks like I cannot pass the Selector Index as a mask parameter into the referenced model. I suspect this is because the Selector indices (and Input port size) are 'nontunable block parameters'; would that be correct?
I can provide the Index as a parameter in the MATLAB workspace, say p1, but that defeats my purpose of being able to use the single parameter p (with instances p(1), p(2), etc.) to distinguish between multiple instances of the Referenced Model.
Am I doing something obvious wrong or is there a way to select a signal from a vector in a parameterised way within a Referenced Model? Three alternatives I can see are:
- Use a Demux signal outside of the Referenced Model and only take in the selected scalar signal. That means a lot of dead ends from the Demux block, because I may not need to use all individual signals.
- Precede each Referenced Model with its own Selector block. This would double the number of blocks in the overall Simulink model.
- Use a Library block for 'masked_X' instead of a Referenced Model. This works fine, but has some other disadvantages (not able to view scopes inside model without disabling the library link first, etc.).
Any suggestions are welcome, or pleae let me know if any clarification is required.
Best regards,
Gerrit.
2 个评论
Penupothula
2023-6-2
Hello Gerrit,
I'm also getting this type of error, If you got any solution can you please post it here.
Thank you
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Model Editing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!