[英]How to list all the channels in .mdf4 file using asammdf in Python?
According to https://asammdf.readthedocs.io/en/latest/api.html#mdf4 :根据https://asammdf.readthedocs.io/en/latest/api.html#mdf4 :
The groups attribute is a list of dicts, each one with the following keys:
groups属性是一个字典列表,每个字典都有以下键:
- […]
[…]
channels
- list of Channel objects with the same order as found in the mdf filechannels
- 与 mdf 文件中的顺序相同的通道对象列表
And according to https://asammdf.readthedocs.io/en/latest/v4blocks.html#channel-class a Channel object has attributes根据https://asammdf.readthedocs.io/en/latest/v4blocks.html#channel-class一个 Channel 对象具有属性
display_name
- str : channel display name;display_name
- str : 频道显示名称; this is extracted from the XML channel comment这是从 XML 通道注释中提取的
name
- str : channel namename
- str : 频道名称
So you should be able to use:所以你应该能够使用:
mdf4 = MDF4(name_of_mdf4_file)
all_channels = []
for group in mdf4.groups:
for channel in group['channels']:
all_channels.append(channel.display_name)
Or use .name
instead of .display_name
, depending on what exactly you need.或使用
.name
而不是.display_name
,具体取决于您的需要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.