Documentation Center

  • 評価版
  • 製品アップデート

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 string 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');

More About

expand all

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.

See Also

| |

Was this topic helpful?