Why does the "blfread" command fail with "Index exceeds the number of array elements" in MATLAB R2022b?

The "blfread" command fails with "Index exceeds the number of array elements" in MATLAB R2022b when reading a specific .blf file. The same file worked without issues in R2019b.
What is the cause of this issue?

 Respuesta aceptada

Cause:
The error occurs because the .BLF file contains CAN frames with a data length exceeding 8 bytes. According to the CAN protocol, the maximum data length for standard CAN frames is 8 bytes. However, your .BLF file contains frames with lengths greater than 8 bytes, likely because CAN FD frames were recorded as standard CAN frames.
In MATLAB releases before R2021b, there was no check for this scenario, so the file was read without issue. Starting from R2021b, stricter error checking was introduced, resulting in the observed error. This check was removed again in R2024a.
Workaround:
Review and correct the DBC file and/or the measurement procedure to ensure that the protocol and message lengths are set correctly, so that standard CAN frames do not exceed 8 bytes.
Permanent Solution:
- Fix the measurement setup to ensure that CAN FD frames are not recorded as standard CAN frames, or ensure all standard CAN frames comply with the 8-byte data length limit.

Más respuestas (0)

Productos

Versión

R2022b

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by