Documentation Center

  • Trial Software
  • Product Updates


Configure 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.

filterAllowOnly(canch, ids, 'type') configures the filter on the channel canch, to pass only messages of the specified type with the specified identifier.

Input Arguments


The CAN channel on which you want to filter messages.


the name of the CAN message that you want to allow. You can specify a single name as a string or a cell array of message names.


The CAN message ID or IDs that you want to allow. You can specify:

  • Single value, such as 600

  • Multiple values, such as [600,610]

  • Range of values, such as [600:800]

  • Multiple ranges, such as [200:400, 600:800]


The identifier type by which to filter messages. CAN messages are 'Standard' and 'Extended'.


To filter a database defined message with name 'EngineMsg', type:

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

To filter messages by identifier, type:

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

More About

expand all


  • Use Database to attach a database to your CAN channel and filter messages using message names.

  • The id value is stored as a decimal value. To convert a hexadecimal to a decimal value, use the hex2dec function.

See Also

| |

Was this topic helpful?