- After unpacking, manually reorder the signals using Selector blocks, Goto/From blocks, or Bus Creator blocks.
- Write a custom MATLAB function or a Simulink Function block that decodes the CAN message based on the signal definitions in the CANdb file. You can then order the outputs of this function as desired.
- Preprocess the CANdb file outside of Simulink to reorder the signals as needed before importing it into the CAN Unpack block.
Ordering of CAN signal ports, when CAN Pack/Unpack is using "CANdb specified signals"
2 次查看(过去 30 天)
显示 更早的评论
Regardless of the order in the CANdb file or the bit order assigned to signals, CAN unpack will show its outputs in alphabetical order. This causes a horrible listing of R1, R11, R12, R2, R3... and so on, which makes the onward processing links untidy and less readable. Worse, the case where the name is changed, causing the order to be altered, the output signals are all incorrectly connected.
Is there a way of forcing the order they are displayed, either by start bit number or the order they appear in the file? (Or by any other meta data attribute such as comment)
0 个评论
回答(1 个)
Anshuman
2024-1-16
In Simulink, when using the CAN Unpack block to decode CAN messages based on a CAN database (CANdb) file, the signals are typically listed alphabetically in the block's output. As of R2023b, there is no built-in feature within the CAN Unpack block to customize the order of the displayed signals based on start bit number, order in the file, or any other metadata attribute.
However, here are some workarounds that you could consider:
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!