Parameterize Simulink Goto and From

25 views (last 30 days)
Aaron on 27 Mar 2015
Commented: Aaron on 9 Apr 2015
Is it possible to parameterize the from and goto tag's using a mask?
In my case, I am trying to share a single multiplier and I want to use the same subsystem as a hook into the multiply with a parameterized name. Each signal pair I mux into the multiply would have it's own prefix and then I would select the tag in the multiplier itself
Ideally, I would even be able to construct a string for the tag like: [name '_mult_in'] [name '_mult_out']
  1 Comment
Aaron on 27 Mar 2015
I should also mention I'm trying to do this in a library subsystem that is linked.
The solution proposed here did not work since it appears to require editing the subsystem

Sign in to comment.

Answers (2)

Sebastian Castro
Sebastian Castro on 9 Apr 2015
In that answer, I only mentioned the case for the Goto block, and not the corresponding From block(s). I'm guessing you'd have to do some extra "magic" for your case to find corresponding tag names. For example, prior to changing the block tag name:
gotoTagName = get_param(gcb,'GoToTag');
fromBlks = find_system(bdroot,'GoToTag',gotoTagName);
Then, you can modify the tag names of the Goto block ( gcb , or 'get current block') and the list of From blocks ( fromBlks ) in one fell swoop.
- Sebastian
  1 Comment
Aaron on 9 Apr 2015
Thanks Sebastian, that is a handy callback!
I'm actually not doing any magic on the "From" side, I just hand select the goto blocks in my multiplier core to select the pair I want. There are a large number of the blocks I show in the image, these are the multiply pairs. I have pair a,b,c,d, ect and mutiplex them into a single, 32 bit multiplier.
I wanted a library link for the pairs themselves so that if I needed to change the way the data type conversions were working (because I made a mistake), I could update all my pairs at the same time.
Here is an updated version of what my multiplier looks like using the from/goto blocks:
User of a masked multiply pair:
Multiply masked subsystem (that I wanted to make a library element)
Multiplier Core

Sign in to comment.

Jason Ghidella
Jason Ghidella on 1 Apr 2015
Hi Aaron,
I have a few extra questions that would help me answer your question. First, the parameter name for the goto and from tags need to be the same in order to match where the from is getting its signal from. So in your example param_goto and param_from would not work. Both need to be the same name, for example something like:
My second question is how are you using the from and goto tags? You mention that you want to have it in a library, this suggests this will be a component. Now are the goto and from tags created and consumed in the same component, or do they need to be accessible throughout the model? If they are self contained, then by simply masking the component where the got and from blocks are used, you get a reusable component that you can put in to a library. The masked block provides a local workspace for that block, so you don't need to parametise the tag. Let me know if this helps.
  1 Comment
Aaron on 1 Apr 2015
Jason, I think a simple example will show what I'm looking to do:
Basically I want the "mult_pair" subsystems all be library elements, since they are all just duplicated with different "Goto" tags

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!