06-29-2021 04:49 PM
Hello,
I have a bunch of tdms files and i want to use the data reduction method when i open them to get the min/max/mean for each channel for every second. The channels have different sample rates, and the number and location of channels are not consistent from the first file to the last. Is there a way i can read the metadata first to get the channel name and "wf_increment", then use the DataFileLoadRed command to load each channel based on the sample rate?
I thought of using the DataFileLoadSel command to open the first 100 samples of each channel in the file, then use information from that instance to do the DataFileLoadRed. Is there anything more direct than this method?
Thanks
Chris
Solved! Go to Solution.
06-30-2021 01:38 AM
Hello Chris,
did you already try to register the data instead of loading?
Call DataFileLoad(MyFolders(0)&"DATA.tdms","TDMS","Register")
I guess this could be sufficient for you. In first step you just collect the information about the file content, but don't change the data. And then (2. step) you really load only the channels you need...
Could it work for you?
06-30-2021 04:39 AM
There is an API that allows you to access file meta without loading the file. Check the DIAdem help for
CreateDataFileHeaderAccess
maybe this will help
Option Explicit
dim filePath : filePath = DataReadPath & "Example.tdms"
Dim dataFileHeaderAccess : set dataFileHeaderAccess = CreateDataFileHeaderAccess
dim dataStore : Set dataStore = dataFileHeaderAccess.Open(filePath ,"TDMS", True)
dim channelO : set channelO = dataStore.RootElements(1).Children("Noise data").Children("Noise_1")
dim channelP : set channelP = channelO.properties
' make sure we can access custom properties
channelP.ListInstanceProperties = true
if channelP.Exists("wf_increment") then
MsgBox channelP("wf_increment").value
end if
06-30-2021 12:24 PM
Thank you Andreas... that is what i wanted!