Simulink Selector block with parameterised indices in masked Referenced Model

3 views (last 30 days)
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:
  1. 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.
  2. Precede each Referenced Model with its own Selector block. This would double the number of blocks in the overall Simulink model.
  3. 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 Comments
Penupothula
Penupothula on 2 Jun 2023
Hello Gerrit,
I'm also getting this type of error, If you got any solution can you please post it here.
Thank you
Gerrit
Gerrit on 2 Jun 2023
Crikey, this is more than four years ago now and I cannot remember for certain how I solved it (or even in which project/model I experienced the issue, so it would be difficult to find exactly what I did). I suspect that, since there weren't any direct responses to my question at that time, I used the second of the potential alternatives that I mentioned above.
I hope that helps a bit and I'm sorry I can't give you a more definitive answer. Good luck with your project.
Best regards,
Gerrit

Sign in to comment.

Answers (0)

Categories

Find more on Large-Scale Modeling 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!