03-28-2011 02:59 PM
I have some temperature channels from a sample. I need to calculate the ROA (Rise over Ambient) for each of these channels.
So I want to take each channel and subtract the ambient channel from it. I can do it using the basic mathematics under the analysis tab but I have a lot of channels to compile and I am not sure how to automate this. I would like the new channel to have the original name plus ROA added to it.
Thanks
03-29-2011 04:30 PM
The way to automate this is through a script. You can get an idea of what the script will look like by going to the script tab and clicking Enable Recording Mode, and then doing the subtract and rename then stop the Script Recording. You can then see an example of what the script will look like and put that code in a For Each Loop that is iterating through each channel you need to change.
03-29-2011 05:00 PM
Hi chandler,
If you post the data set you're talking about, we should be able to give you starter code to work with.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
03-30-2011 08:57 AM
Ok, I've got my script figured out now I am curious if there is a way to get a total group count and then a total channel count that is in the group.
03-31-2011 08:13 AM
Hi chandler,
"GroupCount" will tell you the current number of groups. "GroupChnCount(GroupIndex)" will tell you the number of channels in each group. "CNoXGet(GroupIndex, ChannelIndex) will return a channel reference to the particular channel in a group that you're looping over. This approach will work in all DIAdem versions that have Groups, starting with 9.0.
In DIAdem 11.0 we introduced the "Data" variable, which makes all this much more obvious, if not less complicated:
Data.Root.ChannelGroups.Count
Set Group = Data.Root.ChannelGroups(GroupIndex)
Group.Channels.Count
Set Channel = Group.Channels(ChannelIndex)
Brad Turpin
DIAdem Product Support Engineer
National Instruments