DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate a new column from two existing ?

My time data is stored in two columns: date and time. In order to graph data vs. duration, I would like to compute an "elapsed time in seconds" column from these. How ?

Most generally, how do I create a column where each cell is calculated as a function of other existing cells ?!

Sorry I have to ask here, but I could not find the quick answer using neither DIAdem help or examples, nor Dev. Exchange archives.

Thanks ! oz
0 Kudos
Message 1 of 2
(3,640 Views)
Hi Oz,

The answer to your general question about channel calculations is to use the Formula Calculator in DIAdem, either interactively or programmatically (VBScript). If you look along the top icon bar of the DIAdem-DATA window, you will find one that looks like a pocket calculator, with the tip strip "Formula calculation"-- press this to start the interactive Formula Calculator. In previous versions this was called the "Formula Interpreter" and the icon was "f(x)".

Here you can select channels and functions and variables to manipulate and create whole channels at a time. The syntax that is created for you when you use these buttons is the autosequence syntax, for example:

"Ch(3):= Ch(1)*sin(Ch(2)/pi)" or
"Ch('Scaled Voltage'):= Ch('Voltage')*0.125"


You can execute the same command programmatically by providing the above strings to the FormulaCalc() function.

Now to your specific question, once you have date/time channels in DIAdem, they are already stored as the number of elapsed seconds, relative to 0 AD. So you can add a date column to a time column and correctly create a date/time column. You can switch back and forth between viewing those date/time values as data/time strings or real numbers by changing the channel property "ChnFormat(i)" for that channel (i) to "Time" or "Numeric", respectively. This can be done interactively in the "Channel properties" tab of DIAdem-DATA or by assigning values to ChnFormat(i) programmatically in a VBScript.

Ask if you further questions regarding getting your date and time columns from you ASCII file successfully into DIAdem as date/time numbers.

Regards,
Brad Turpin
NI
0 Kudos
Message 2 of 2
(3,640 Views)