Skip to content

passing list data structure in channel #330

Answered by adamreeve
ntp3105 asked this question in Q&A
Discussion options

You must be logged in to vote

Right, yes using a loop over names would make sense. If you don't know the group and channel names ahead of time you can loop over all groups and channels using the TdmsFile.groups and TdmsGroup.channels methods. Eg:

for group in tdms_file.groups():
    print(f"group '{group.name}'")
    for channel in group.channels():
        print(f"channel '{channel.name}'")

Or alternatively you can actually iterate over the TdmsFile and TdmsGroup objects to get the names too:

for group_name in tdms_file:
    print(f"group '{group_name}'")
    group = tdms_file[group_name]
    for channel_name in group:
        print(f"channel '{channel_name}'")
        channel = group[channel_name]

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ntp3105
Comment options

@adamreeve
Comment options

Answer selected by adamreeve
@ntp3105
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants