filterAllowOnly

Configure CAN message filter to allow only specified messages

Description

example

filterAllowOnly(canch,name) configures the filter on the channel canch to pass only messages with the specified name.

Set the channel object Database property to attach a database to allow filtering by message names.

example

filterAllowOnly(canch,IDs,type) configures the filter on the channel canch to pass only messages of the specified identifier type and values.

Examples

collapse all

Filter a database defined message with the name 'EngineMsg'

canch = canChannel('Vector','CANCaseXL 1',1);
canch.Database = canDatabase('candatabase.dbc');
filterAllowOnly(canch,'EngineMsg')

Filter messages by identifiers.

canch = canChannel('Vector','CANCaseXL 1',1);
filterAllowOnly(canch,[602 612],'Standard')

Input Arguments

collapse all

CAN device channel, specified as a CAN channel object, on which to filter.

Example: canch = canChannel('NI','CAN1')

Name of CAN messages that you want to allow, specified as a character vector, string, or supporting array of these types.

Example: 'EngineMsg'

Data Types: char | string | cell

CAN message IDs that you want to allow, specified as a numeric value or vector.

Specify IDs as a decimal value. To convert a hexadecimal to a decimal value, use the hex2dec function.

Example: 600, [600,610], [600:800], [200:400,600:800]

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

Identifier type by which to filter, specified as a character vector or string. CAN messages identifier types are 'Standard' and 'Extended'.

Example: 'Standard'

Data Types: char | string

Introduced in R2011b