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.


Set specific CAN message acceptance filter configuration


filterSet(canch, code, mask, idtype)
filterSet(canch, id, idtype)

    Note:   You cannot set filters on an NI device channel.


filterSet(canch, code, mask, idtype) sets the CAN message acceptance filter to the specified code and mask. You also must specify the CAN identifier type idtype on the CAN channel canch.

filterSet(canch, id, idtype) sets the CAN message acceptance filter by determining the best possible code and mask based on the ID and identifier type specified in the input argument.

Input Arguments


The CAN channel that you want to set the filter for.


The value required for each bit position of the identifier.


The bits in the identifier that are relevant to the filter.


Set a filter on the CAN message with the id, range of ids, multiple ranges of ids, or a combination of ids.


A character vector specifying either a standard or an extended CAN message id type.


canch = canChannel('Vector','CANCaseXL 1',1)
filterSet(canch,500,750, 'Standard')

To let Vehicle Network Toolbox™ determine the best possible code and mask option:

 canch = canChannel('Kvaser', 'USBcan Professional 1', 1)
 filterSet(canch, [500:502 1000], 'Standard')
 filterSet(canch, [7500:8000 12000], 'Extended')


  • You can configure message filtering only when the CAN channel is offline.

  • CAN message filters initialize to fully open.

  • Use filterReset to make the acceptance filters fully open.

  • filterSet supports either standard or extended CAN identifiers.

Introduced in R2009a

Was this topic helpful?