Main Content


Construct CAN FD channel connected to specified device



canch = canFDChannel(vendor,device,devicechannelindex) returns a CAN FD channel connected to a device from a specified vendor.

For Vector and Kvaser products, device combines the device type and a device index, such as 'CANCaseXL 1'. For example, if there are two Vector devices, device can be 'VN1610 1' or 'VN1610 2'.

canch = canFDChannel(vendor,device) returns a CAN FD channel connected to a National Instruments™ or PEAK-System device.

For National Instruments, vendor is the character vector 'NI', and the devicenumber is the interface number defined in the NI Measurement & Automation Explorer.

For PEAK-System devices vendor is the character vector 'PEAK-System', and devicenumber is the device number defined for the channel.


collapse all

Create CAN FD channels for each of several vendors.

ch1 = canFDChannel('Vector','VN1610 1',1);
ch2 = canFDChannel('Kvaser','USBcan Pro 1',1);
ch3 = canFDChannel('NI','CAN0');
ch4 = canFDChannel('PEAK-System','PCAN_USBBUS1');
ch5 = canChannel('SocketCAN','can0')
ch6 = canFDChannel('MathWorks','Virtual 1',1)
ch6 = 

  Channel with properties:

   Device Information
            DeviceVendor: 'MathWorks'
                  Device: 'Virtual 1'
      DeviceChannelIndex: 1
      DeviceSerialNumber: 0
            ProtocolMode: 'CAN FD'

   Status Information
                 Running: 0
       MessagesAvailable: 0
        MessagesReceived: 0
     MessagesTransmitted: 0
    InitializationAccess: 1
        InitialTimestamp: [0×0 datetime]
           FilterHistory: 'Standard ID Filter: Allow All | Extended ID Filter: Allow All'

   Bit Timing Information
               BusStatus: 'N/A'
              SilentMode: 0
         TransceiverName: 'N/A'
        TransceiverState: 'N/A'
       ReceiveErrorCount: 0
      TransmitErrorCount: 0
     ArbitrationBusSpeed: []
            DataBusSpeed: []

   Other Information
                Database: []
                UserData: []

Input Arguments

collapse all

CAN device vendor, specified as 'MathWorks', 'Kvaser', 'NI', 'PEAK-System', 'SocketCAN', or 'Vector'.

Example: 'MathWorks'

Data Types: char | string

CAN FD device to connect channel to, specified as a character vector or string. Valid values depend on the specified vendor.

Example: 'Virtual 1'

Data Types: char | string

CAN FD device channel port or index, specified as a numeric value.

Example: 1

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Output Arguments

collapse all

CAN FD device channel, returned as a can.Channel object, with can.Channel Properties.


  • Use canFDChannelList to obtain a list of available device channels.

  • You cannot have more than one CAN FD channel configured on the same NI-XNET or PEAK-System device channel.

  • You cannot use the same variable to create multiple channels sequentially. Clear any channel in use before using the same variable to construct a new channel object.

  • You cannot create arrays of channel objects. Each object you create must exist as its own individual variable.

Version History

Introduced in R2018b