How to use a For iterator

27 vues (au cours des 30 derniers jours)
Zhenteng Shen
Zhenteng Shen le 31 Juil 2017
Hi everyone, I'm new this Simulink, my situation is basically: I have a control map (function of 3 variables), 2 of the inputs stay constant and one input can take 5 different values, instead of having 5 different map reading blocks I've been told I can just make one for iteration block which I sort of attempted to do.
I proceeded to add my inputs in the For iterator subsystem but wan't sure what to do with the actual 'For iterator' inside the subsystem, where do I hook up the output to? internal or external limit source? and if I have 5 values do I want to iterate it 5 times? I want the map to be read indefinitely and in real time though.
THANK YOU!!!
  2 commentaires
Swarooph
Swarooph le 31 Juil 2017
Modifié(e) : Swarooph le 31 Juil 2017
Note that there are TWO types of FOR subsystems. According to the documentation:
For Iterator Subsystem: Represent subsystem that executes repeatedly during simulation time step. Doc here.
For Each Subsystem: Repeatedly perform algorithm on each element or subarray of input signal and concatenate results. Doc here .
What you choose here depends on the kind of output you are looking for. This is a little vague from your explanation.
To me it looks like you want the second. That is, take in the 2 constant inputs and FOR EACH element in the 3rd input, read maps accordingly. The output will be a concatenated 5xn value for all the 3rd inputs together.
If this is not what you are looking for, let us know specifically with examples what output you desire. If you can include the sizes of the inputs and the expected outputs, it will be better to help as well.
Zhenteng Shen
Zhenteng Shen le 1 Août 2017
Thank you so much, that really helped! I have now managed to do it.

Connectez-vous pour commenter.

Réponses (1)

Swarooph
Swarooph le 1 Août 2017
Copy/pasting helpful comment as an answer:
Note that there are TWO types of FOR subsystems. According to the documentation:
For Iterator Subsystem: Represent subsystem that executes repeatedly during simulation time step. Doc here.
For Each Subsystem: Repeatedly perform algorithm on each element or subarray of input signal and concatenate results. Doc here .
What you choose here depends on the kind of output you are looking for. This is a little vague from your explanation.
To me it looks like you want the second. That is, take in the 2 constant inputs and FOR EACH element in the 3rd input, read maps accordingly. The output will be a concatenated 5xn value for all the 3rd inputs together.
If this is not what you are looking for, let us know specifically with examples what output you desire. If you can include the sizes of the inputs and the expected outputs, it will be better to help as well.

Catégories

En savoir plus sur Subsystems dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by