MATLAB 帮助中心
配置 CAN 报文过滤器,使之仅允许通道接收指定的报文
filterAllowOnly(canch,name)
filterAllowOnly(canch,IDs,type)
filterAllowOnly(canch,name) 配置通道 canch 上的过滤器,使之仅允许具有指定名称的报文通过。
canch
name
设置通道对象的 Database 属性来连接数据库,以允许按报文名称进行过滤。
Database
示例
filterAllowOnly(canch,IDs,type) 配置通道 canch 上的过滤器,使之仅允许具有指定标识符类型和值的报文通过。
IDs
type
全部折叠
使用名称 'EngineMsg' 过滤数据库定义的报文。
'EngineMsg'
canch = canChannel('Vector','CANCaseXL 1',1); canch.Database = canDatabase('candatabase.dbc'); filterAllowOnly(canch,'EngineMsg')
按标识符过滤报文。
canch = canChannel('Vector','CANCaseXL 1',1); filterAllowOnly(canch,[602 612],'Standard')
要对其进行过滤的 CAN 设备通道,指定为 CAN 通道对象。
示例: canch = canChannel('NI','CAN1')
canch = canChannel('NI','CAN1')
要允许的 CAN 报文的名称,指定为字符向量、字符串或这些类型的支持数组。
示例: 'EngineMsg'
数据类型: char | string | cell
char
string
cell
要允许的 CAN 报文 ID,指定为数值或向量。
将 IDs 指定为十进制值。要将十六进制转换为十进制值,请使用 hex2dec 函数。
hex2dec
示例: 600, [600,610], [600:800], [200:400,600:800]
600
[600,610]
[600:800]
[200:400,600:800]
数据类型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
single
double
int8
int16
int32
int64
uint8
uint16
uint32
uint64
'standard'
'extended'
作为过滤依据的标识符类型,指定为字符向量或字符串。CAN 报文标识符类型为 'Standard' 和 'Extended'。
'Standard'
'Extended'
示例: 'Standard'
数据类型: char | string
在 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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处