Parameterize Simulink Goto and From
Ältere Kommentare anzeigen
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']
R2015a

1 Kommentar
Aaron
am 27 Mär. 2015
Antworten (3)
Sebastian Castro
am 9 Apr. 2015
I answered to the previous question you referred to: http://www.mathworks.com/matlabcentral/answers/139841-how-to-create-dynamic-goto-tag-names-in-simulink
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 Kommentar
Aaron
am 9 Apr. 2015
Jason Ghidella
am 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:
[param_goto_from_1]
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 Kommentar
Vedang Kokil
am 13 Jul. 2023
0 Stimmen
Hi, I have a follow up question. I want to use get_params in command line to access the value of the goto block and not the tag. Is there any particular parameter that I can use with get_param ?
Thanks.
Kategorien
Mehr zu Using MATLAB Projects in Simulink finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


