Main Content

length

Determine length of message queue

Description

length(message_name) checks the number of messages in the internal receiving queue of an input or local message.

example

Examples

expand all

Check the queue for message M. If a message is present, remove it from the queue. If exactly seven messages remain in the queue, increment the value of x.

during:
   if receive(M) == true
      if length(M) == 7
         x = x+1;
      end
   end

Stateflow chart that uses the length operator.

Tips

  • The length operator is not supported for input messages that use external receiving queues. To use the length operator, enable the Use Internal Queue property for this message.

Version History

Introduced in R2015b