Changing Simevent attribute using Matlab Function Block
Mostra commenti meno recenti
Hello,
Lets suppose I want to select an Output Switch's port based on the value of an entity's attribute. If Attr == 0 then port 1 is selected, else port 2. There are several ways to do it, but I chose to implement it as shown in the image bellow, using a Get Attribute block a Matlab Function block with a Server in parallel in order to add a delay until Matlab Function's output is calculated.

The Matlab function is the following:
function PortSel = fcn(Attr)
PortSel = (Attr > 0)+1;
My question is why does the Server need a delay of 1 instead of zero in order the system to work as expected?
What I am trying to understand is when the Matlab Function block's code is calculated in order to use it in other situations. For example the same question arises if instead of an output switch I used a Set Attribute Block as stated by Devdatt Lad in this thread.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Discrete-Event Simulation in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!