Main Content

discard

Discard message

Description

example

discard(message_name) discards a valid input or local message. After a chart discards a message, it can remove another message from the queue in the same time step. A chart cannot access the data of a discarded message.

Examples

expand all

Check the queue for message M. If a message is present, remove it from the queue. If the message has a data value equal to 3, discard the message.

during:
   if receive(M) == true
      if M.data == 3
         discard(M);
      end
   end

Stateflow chart that uses the discard operator.

Introduced in R2018b