This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Selection Server - Select Specific Entities from Server


This example shows how you can use the MATLAB Discrete Event System block to write a custom N-Server from which specific entities can be selected using a key lookup. Passengers enter from the IN port of the block and are stored in the block until a message arrives at the KEY port carrying a lookup key. Upon receiving this message, the system schedules an "Iterate" event during which it can visit every entity stored in it and output the one that matches the key.


The simulation prints information about entities entering the MATLAB Discrete Event System block and selection commands.

Passenger entry: key = 2.000000
Passenger entry: key = 10.000000
Baggage entry: key = 10.000000
Passenger exit: key = 10.000000
Passenger entry: key = 4.000000
Passenger entry: key = 5.000000
Passenger entry: key = 3.000000
Baggage entry: key = 3.000000
Passenger exit: key = 3.000000
Passenger entry: key = 8.000000
Passenger entry: key = 7.000000
Passenger entry: key = 1.000000
Baggage entry: key = 8.000000
Passenger exit: key = 8.000000
Passenger entry: key = 6.000000
Passenger entry: key = 9.000000