Documentation

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.

filterAllowOnly

Configure message filter to allow only specified messages

Syntax

filterAllowOnly(canch,name)
filterAllowOnly(canch,ids,type)

Description

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

canch

The CAN channel on which you want to filter messages.

name

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.

ids

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]

type

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

Examples

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

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

To filter messages by identifier, type:

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

Tips

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