Help CenterHelp Center
Configure CAN message filter to allow only specified messages
filterAllowOnly(canch,name)
filterAllowOnly(canch,IDs,type)
filterAllowOnly(canch,name) configures the filter on the channel canch to pass only messages with the specified name.
canch
name
Set the channel object Database property to attach a database to allow filtering by message names.
Database
example
filterAllowOnly(canch,IDs,type) configures the filter on the channel canch to pass only messages of the specified identifier type and values.
IDs
type
collapse all
Filter a database defined message with the name 'EngineMsg'.
'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')
CAN device channel, specified as a CAN channel object, on which to filter.
Example: canch = canChannel('NI','CAN1')
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
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.
hex2dec
Example: 600, [600,610], [600:800], [200:400,600:800]
600
[600,610]
[600:800]
[200:400,600:800]
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
single
double
int8
int16
int32
int64
uint8
uint16
uint32
uint64
'standard'
'extended'
Identifier type by which to filter, specified as a character vector or string. CAN messages identifier types are 'Standard' and 'Extended'.
'Standard'
'Extended'
Example: 'Standard'
Data Types: char | string
Introduced in R2011b
canChannel
canDatabase
filterAllowAll
filterBlockAll
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office