Extract CAN signals from Message list as array
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I have series of CAN message objects containing a variety of messages, each carrying several signals (in the 100,000s of elements each) from previous recordings. I also have the corresponding database so I can convert to physical values (volts, rpm...)
Here is what I have managed so far:
Attach the database to my Raw messages:
attachDatabase(AllMessages, db); %AllMessages = large log of mixed CAN messages, db = my database
Extract a single message ID into a new object:
Extract_BMS = extractAll(AllMessages,'BMS_RN1'); %Returns a CAN message object with only 'BMS_RN1' messages
Access all signals from a single message as physical values: (in this example, message number 4321)
Extract_BMS(1,4321).Signals
ans =
struct with fields:
HVIsolationImpedance: 1000000
BMS_InterlockHVconnector_v2: 2
BMS_HVNetworkVoltage_v2: 374.5000
HVBatInstantCurrent_v2: 3.6250
HVPowerConnection: 1
BMS_InterlockServicePlug_v2: 2
Acces a single signal physical value:
MyVoltage = Extract_BMS(1,4321).Signals.BMS_HVNetworkVoltage_v2 %Extract voltage from frame 4321
MyVoltage =
374.5000
However, I can't find an elegant way of returning a large array of physical values, something like this:
>> VoltageArray = Extract_BMS(1,1:999).Signals.BMS_HVNetworkVoltage_v2
Expected one output from a curly brace or dot indexing expression, but there were 999 results.
I could make a loop for each signal in each message and fill arrays element by element, but there has to be a better way. It might just be me not being very experienced with structures.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Database Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!