Main Content

extractAll

Select all instances of CAN message from message array

Description

extracted = extractAll(message,messagename) parses the given array message, and returns all instances of messages matching the specified message name.

extracted = extractAll(message,id,extended) parses the given array message, and returns all instances of messages matching the specified ID value and type.

[extracted,remainder] = extractAll(___) assigns to extracted those messages that match the search, and returns to remainder those that do not match.

example

Examples

collapse all

Extract messages by matching name and IDs.

Extract messages by name.

msgOut = extractAll(msgs,'DoorControlMsg');

Extract all messages with IDs 200 and 5000. Note that 5000 requires an extended style ID.

msgOut = extractAll(msgs,[200 5000],[false true]);

Extract messages and also return the remainder.

[msgOut,remainder] = extractAll(msgs,{'DoorControlMsg','WindowControlMsg'});

Input Arguments

collapse all

CAN messages to parse, specified as an array of CAN message objects. This is the collection from which you extract messages by specific names or IDs.

Name of message to extract, specified as a character vector, string, or array that supports these types.

Example: 'DoorControlMsg'

Data Types: char | string | cell

ID of message to extract, specified as a numeric value or vector. Using this argument also requires that you specify an extended argument.

Example: [200 400]

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Indication of extended ID type, specified as a logical true or false. Use a value true if the ID type is extended, or false if standard. This argument is required if you specify a message ID.

If the message ID is a numeric vector, use a logical vector of the same length for extended. For example, if you specify id and extended as [250 5000],[false true], then extractAll returns all instances of CAN messages 250 and 5000 found within in the message array.

Example: true

Data Types: logical

Output Arguments

collapse all

Extracted CAN messages, returned as an array of CAN message objects. These are the messages whose name or ID matches the specified value.

Unmatched CAN messages, returned as an array of CAN message objects. These are the messages in the original set whose name or ID does not match the specified value.

Version History

Introduced in R2009a

See Also

Functions