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.


Extract message from queue





receive(message_name) extracts an input or local message from queue. If a valid message exists, receive returns true. If a valid message does not exist but there is a message in the queue, the chart removes the message from the queue and receive returns true. If a valid message does not exist and there are no messages in the queue, receive returns false.


expand all

Check the queue for message M and increment the value of x if both of these conditions are true:

  • A message is present in the queue.

  • The data value of the message is equal to 3.

If a message is not present or if the data value is not equal to 3, then the value of x does not change. If a message is present, the chart removes it from the queue regardless of whether x is modified.

if receive(M) && == 3
    x = x+1;

Introduced in R2018b