Overview
This example shows you how to programmatically separate even and odd data points from one channel and add them to two new channels.
Description
Below is a snippet on how to seperate even and odd data points in DIAdem.
Code:
Dim PlaceCountodd, PlaceCounteven
Dim i
PlaceCounteven = 1 'Track where in the new even channel you are
PlaceCountodd = 1 'Track where in the new odd channel you are
'Cycle through all the values in the channel by getting the channel size and check if values are even or odd
For i = 1 TO Data.Root.ChannelGroups(1).Channels("untitled").Size
If Data.Root.ChannelGroups(1).Channels("untitled").Values(i) Mod 2 <> 0 Then
Call DataBlCopy("'untitled'", i, 1, "'Odd'", PlaceCountodd)
PlaceCountodd = PlaceCountodd + 1
ElseIf Data.Root.ChannelGroups(1).Channels("untitled").Values(i) Mod 2 = 0 Then
Call DataBlCopy("'untitled'", i, 1, "'Even'", PlaceCounteven )
PlaceCounteven = PlaceCounteven + 1
End If
Next
Steps to Implement or Execute Code
Requirements
Software
DIAdem 11.0
**This document has been updated to meet the current required format for the NI Code Exchange. For more details visit this discussion thread**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.