This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Configure message filter to allow only specified messages




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 character vector 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');


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

Introduced in R2011b

Was this topic helpful?