DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Reducing number of values

Solved!
Go to solution

how can i loop this so it automatically reads the 13 files in a folder and appends all the files so i dont have to run them one by one

 

or a way in which it combines all the RMS values so i dont have 13 different files, just 1 file in proper sequence

0 Kudos
Message 11 of 15
(619 Views)

Hi hmurya,

 

Here's how to append-load all the TDMS files in a certain folder.  There's an append-load option to the DataFileLoad...() commands in DIAdem 2015 and later, but this set of commands will work on previous DIAdem versions as well.

DataFolder = "D:\NICS\Discussion Forums\hmurya\Data Folder\"
DataFiles = DirListGet(DataFolder, "*.tdms", "filename", "FullFilenames")
'LogFileWrite Join(DataFiles, vbCRLF)
iMax = UBound(DataFiles)
Call Data.Root.Clear
Call DataFileLoadSel(DataFiles(0), "TDMS", "[1]/[1]")
Set Group = Data.Root.ChannelGroups(1)
Set AppChannel = Group.Channels(1)
FOR i = 1 TO iMax
  Set NewChannel = DataFileLoadSel(DataFiles(i), "TDMS", "[1]/[1]")
  Call ChnConcat(NewChannel, AppChannel)
  Call Group.Channels.Remove(2)
NEXT ' i

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 12 of 15
(609 Views)

Hello.

I am running into a small problem here. I was informed experiment was run for a total of 360seconds, but when I run the script, it gives me an output of 444secs.

 

Can you explain the script to me and what part of it uses to measure how many data points make up a second?

0 Kudos
Message 13 of 15
(514 Views)

Hi hmurya,

 

I assume you're referring to the script on the first page of this Discussion Forum post, not the script immediately above your post.  The script on the first post page determines the sampling period from the waveforma property ("wf_increment"), then inverts that to determine the number of values per second (SecVals).  It then calculates the RMS value for each second by running the StatBlockCal() command over each second of values:

 

Delta = DatChannel.Properties("wf_increment").Value
Call ChnWfPropSet(RmsChannel, "Time", "s", (Start+1)/2, 1)
SecVals = 1/Delta
FOR i = 1 TO iMax Step SecVals

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 14 of 15
(494 Views)

ah alright.

 

what function would i need to use instead to calculate skewness and kurtosis the same way? Currently I am getting a single value for the whole length of the file.

0 Kudos
Message 15 of 15
(464 Views)