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!