DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

X Value for a correcting CMAx of Y channel

Hi There,
 
I am tryinig to read in the Cmax of a Y channel. This is fine, I have no issues. But would like o get the corresponding time value(X -channel) when CMax occurs. For this I check each value of the channel using CHDX and get the X value, hence involves lot of processing time.
 
Can anyone let me know if ther is a quick way to get this done?
 
Thanks,
Priya
0 Kudos
Message 1 of 5
(4,040 Views)
Hi ATE,

This can be done with a relatively simple Formular Calculator function. In my example below I have two channels, called "Time" and "Noise". I want to find the vlue in "Time" where "Noise" reached it maximum value.

      R1:=ChD(find('Noise'=CMax('Noise')),'Time')

R1       is a REAL type DIAdem variable that is available to DIAdem users to store calculation results
ChD    is a variable that contains the value of a cell, it has two parameters, "Channel" and "Row"
find      is a function in DIAdem that allows you to search for the row number in a channel where a condition is true

The above example will find the row number (integer) which contains the maximum value of "Noise" find('Noise'=CMax('Noise'))
It will then transfer the value found in that row in the "Time" channel to the variable R1

Let me know if you need anything else,

   Otmar
Otmar D. Foehner
0 Kudos
Message 2 of 5
(4,022 Views)

Hi Priya,

Sure, you can use either the Find() or the PNo() functions to return the corresponding row number of that maximum value.  The Find() function will only return a row if an exact match occurs, while the PNo() function will always return the row number whose Y value is closest to the value you're searching for.  The Find() function also has an optional second parameter which is the start row of the search.

One question to ask yourself is whether this maximum value might ever occur more than once in the channel, and if so, how you want to react to that possibility.  Below you will find a VBScript attached which uses the Find() function to identify all occurences of the maximum value.

Ask if you have additional questions,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 3 of 5
(4,019 Views)

Hello,

I am able to use the Find() and CHD() functions as shown in this thread to determine the X-value corresponding to Cmax, however as far as I can tell this only works with numeric channels.  Is there a corresponding method than can be used for waveform channels?  I am using this function in a text box on a report.

Thanks,

Craig

0 Kudos
Message 4 of 5
(3,729 Views)

Hi Craig,

For waveform channels use "ChDWfX(row, channel)" instead of "ChD(row, channel)".

Brad Turpin
DIAdem Product Support Engineer
National Instruments 

0 Kudos
Message 5 of 5
(3,721 Views)