Assign Attribute From Matlab Workspace
1 view (last 30 days)
Show older comments
I have a 2-D array that is created in Matlab that I want to increment through and assign as 1-D vectors to a sequence of entities.
4 Comments
Accepted Answer
Devdatt Lad
on 13 Jun 2011
Use the statistic Number of entities departed, #d from the time-based entity generator block and feed it to a Discrete Event Subsystem which contains a Constant block followed by a Selector block. Set the constant value to be the workspace variable, and feed the #d signal as the index port of the selector block. Thus, for the i-th entity, the selector will output Constant[i]. Use the Set Attribute block at the output of the Discrete-Event Subsystem to set this value as the entity's attribute. Is this what you are looking for?
Remember to use a single server with service time 0, between the time-based entity generator and the set attribute block to get the timing right. More on that here.
More Answers (1)
See Also
Categories
Find more on Discrete-Event Simulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!