Example Code

Find Target Value in Sections of Data with DIAdem Script

Code and Documents


Download All


You can add functionality to DIAdem by creating scripts to automate tasks.  This script looks for a target value within subsets of a larger channel, and then stores the result for each subset into a new channel.

Steps to Complete

1. Download and save the attachments: findVal.VBS and data.tdms

2. Open DIAdem and go to the Script pane.

3. Load findVal.VBS and go to the second line of the script.

4. Change the filepath to the location where you stored the TDMS file.

5. Run the script.

Additional Notes

The sum of all the data in the zeroCount channel is the total number of target values found.  The search algorithm depends on the value being crossed in the space between two data points.  This may not always be the case, in which case the script will fail to produce accurate results.  Other algorithms can be substituted into the general structure provided by the rest of the code.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.