DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

zeroing NoValues and other data analysis questions

I'm currently trying to analyze several channels of data.  The data I'm collecting sometimes is imported into DIAdem 9.1 as noValues.  Is there a way to remove the same row in the Y-Channel data and the X-Channel data if either one has a no value?
 
I think the easiest way might be in a For...Next Loop due to the fact I am also testing for other values as well.
 
Currently I have:
 
Dim duration, counter, clock                          'define param
counter = 1                                                     'start the counter
Set duration = ChnLength("Time")                 'find the duration

Call ChnAlloc("z1Channel",ChnLength("Time"),1,"DataTypeFloat64")
Call ChnAlloc("z2Channel",ChnLength("Time"),1,"DataTypeFloat64")                           'create several output data lists
Call ChnAlloc("z3Channel",ChnLength("Time"),1,"DataTypeFloat64")

For clock = 1 to duration

  If ((ChDX(clock,"y1Channel") <= 0) and (ChDx(clock,"y2Channel") <= 0)) Then
ChDx(counter,"PPStimes")=clock
counter = counter + 1
End If
0 Kudos
Message 1 of 14
(3,771 Views)
Hi,

there's a simple solution. The following statement sets all channel values < 0 to NoValue:

Call FormulaCalc("Ch(""MyChannel"") := Ch(""MyChannel"") * (Ch(""MyChannel"") >= 0) + NoValue * (Ch(""MyChannel"") < 0)")

After that you can use the ChnNovHandle command to eliminate these NoValues and the corresponding values in the same rows in other channels.

Christian
0 Kudos
Message 2 of 14
(3,759 Views)
Thanks for the reply.  Sorry about the multiple posts, I actually had a newer updated version of this question that I was trying to post.
 
Thanks for the tip, I was missing the extra pair of "" around my strings.
Call FormulaCalc("Ch(""MyChannel"") := Ch(""MyChannel"") * (Ch(""MyChannel"") >= 0) + NoValue * (Ch(""MyChannel"") < 0)")
 
The other part was
 
My:
Call ChnNovHandle("Time","MyChannel","Delete","XY",False,True)
was not deleting NoValues in my Time and MyChannel channels.
 
and why won't this work?
 
Dim intDuration,intCounter,intTime   'define variables
intCounter = 1                        'start counter
intDuration = ChnLength("Time")     'set duration
 
For intTime = 1 to intDuration
For intTime2 = intTime2 to intDuration
If ((ChDx(intTime,"y1Channel") = NOVALUE) and (ChDx(intTime2,"y2Channel") = 0)) Then
'something happens here, I had it set to MsgBox ("Hello") for testing because I know that for certain times in my Time channel, I do have NoValues in y1Channel and zero values in my y2Channel.
End If
Next
Next
 
 
0 Kudos
Message 3 of 14
(3,736 Views)
Thanks for the reply.  Sorry about the multiple posts, I actually had a newer updated version of this question that I was trying to post.
 
Thanks for the tip, I was missing the extra pair of "" around my strings.
Call FormulaCalc("Ch(""MyChannel"") := Ch(""MyChannel"") * (Ch(""MyChannel"") >= 0) + NoValue * (Ch(""MyChannel"") < 0)")
 
The other part was
 
My:
Call ChnNovHandle("Time","MyChannel","Delete","XY",False,True)
was not deleting NoValues in my Time and MyChannel channels.
 
and why won't this work?
 
Dim intDuration,intCounter,intTime   'define variables
intCounter = 1                         'start counter
intDuration = ChnLength("Time")     'set duration
 
For intTime = 1 to intDuration
For intTime2 = intTime2 to intDuration
If ((ChDx(intTime,"y1Channel") = NOVALUE) and (ChDx(intTime2,"y2Channel") = 0)) Then
'something happens here, I had it set to MsgBox ("Hello") for testing because I know that for certain times in my Time channel, I do have NoValues in y1Channel and zero values in my y2Channel.
End If
Next
Next
 
 
0 Kudos
Message 4 of 14
(3,736 Views)
Thanks for the reply.  Sorry about the multiple posts, I actually had a newer updated version of this question that I was trying to post.
 
Thanks for the tip, I was missing the extra pair of "" around my strings.
Call FormulaCalc("Ch(""MyChannel"") := Ch(""MyChannel"") * (Ch(""MyChannel"") >= 0) + NoValue * (Ch(""MyChannel"") < 0)")
 
The other part was
 
My:
Call ChnNovHandle("Time","MyChannel","Delete","XY",False,True)
was not deleting NoValues in my Time and MyChannel channels.
 
and why won't this work?
 
Dim intDuration,intCounter,intTime   'define variables
intCounter = 1                          'start counter
intDuration = ChnLength("Time")     'set duration
 
For intTime = 1 to intDuration
For intTime2 = intTime2 to intDuration
If ((ChDx(intTime,"y1Channel") = NOVALUE) and (ChDx(intTime2,"y2Channel") = 0)) Then
'something happens here, I had it set to MsgBox ("Hello") for testing because I know that for certain times in my Time channel, I do have NoValues in y1Channel and zero values in my y2Channel.
End If
Next
Next
 
 
0 Kudos
Message 5 of 14
(3,736 Views)
Thanks for the reply.  Sorry about the multiple posts, I actually had a newer updated version of this question that I was trying to post.
 
Thanks for the tip, I was missing the extra pair of "" around my strings.
Call FormulaCalc("Ch(""MyChannel"") := Ch(""MyChannel"") * (Ch(""MyChannel"") >= 0) + NoValue * (Ch(""MyChannel"") < 0)")
 
The other part was
 
My:
Call ChnNovHandle("Time","MyChannel","Delete","XY",False,True)
was not deleting NoValues in my Time and MyChannel channels.
 
and why won't this work?
 
Dim intDuration,intCounter,intTime   'define variables
intCounter = 1                           'start counter
intDuration = ChnLength("Time")     'set duration
 
For intTime = 1 to intDuration
For intTime2 = intTime2 to intDuration
If ((ChDx(intTime,"y1Channel") = NOVALUE) and (ChDx(intTime2,"y2Channel") = 0)) Then
'something happens here, I had it set to MsgBox ("Hello") for testing because I know that for certain times in my Time channel, I do have NoValues in y1Channel and zero values in my y2Channel.
End If
Next
Next
 
 
0 Kudos
Message 6 of 14
(3,736 Views)
Thanks for the reply.  Sorry about the multiple posts, I actually had a newer updated version of this question that I was trying to post.
 
Thanks for the tip, I was missing the extra pair of "" around my strings.
Call FormulaCalc("Ch(""MyChannel"") := Ch(""MyChannel"") * (Ch(""MyChannel"") >= 0) + NoValue * (Ch(""MyChannel"") < 0)")
 
The other part was
 
My:
Call ChnNovHandle("Time","MyChannel","Delete","XY",False,True)
was not deleting NoValues in my Time and MyChannel channels.
 
and why won't this work?
 
Dim intDuration,intCounter,intTime   'define variables
intCounter = 1                            'start counter
intDuration = ChnLength("Time")     'set duration
 
For intTime = 1 to intDuration
For intTime2 = intTime2 to intDuration
If ((ChDx(intTime,"y1Channel") = NOVALUE) and (ChDx(intTime2,"y2Channel") = 0)) Then
'something happens here, I had it set to MsgBox ("Hello") for testing because I know that for certain times in my Time channel, I do have NoValues in y1Channel and zero values in my y2Channel.
End If
Next
Next
 
 
0 Kudos
Message 7 of 14
(3,734 Views)
Thanks for the reply.  Sorry about the multiple posts, I actually had a newer updated version of this question that I was trying to post.
 
Thanks for the tip, I was missing the extra pair of "" around my strings.
Call FormulaCalc("Ch(""MyChannel"") := Ch(""MyChannel"") * (Ch(""MyChannel"") >= 0) + NoValue * (Ch(""MyChannel"") < 0)")
 
The other part was
 
My:
Call ChnNovHandle("Time","MyChannel","Delete","XY",False,True)
was not deleting NoValues in my Time and MyChannel channels.
 
and why won't this work?
 
Dim intDuration,intCounter,intTime   'define variables
intCounter = 1                             'start counter
intDuration = ChnLength("Time")     'set duration
 
For intTime = 1 to intDuration
For intTime2 = intTime2 to intDuration
If ((ChDx(intTime,"y1Channel") = NOVALUE) and (ChDx(intTime2,"y2Channel") = 0)) Then
'something happens here, I had it set to MsgBox ("Hello") for testing because I know that for certain times in my Time channel, I do have NoValues in y1Channel and zero values in my y2Channel.
End If
Next
Next
 
 
0 Kudos
Message 8 of 14
(3,734 Views)
Thanks for the reply.  Sorry about the multiple posts, I actually had a newer updated version of this question that I was trying to post.
 
Thanks for the tip, I was missing the extra pair of "" around my strings.
Call FormulaCalc("Ch(""MyChannel"") := Ch(""MyChannel"") * (Ch(""MyChannel"") >= 0) + NoValue * (Ch(""MyChannel"") < 0)")
 
The other part was
 
My:
Call ChnNovHandle("Time","MyChannel","Delete","XY",False,True)
was not deleting NoValues in my Time and MyChannel channels.
 
and why won't this work?
 
Dim intDuration,intCounter,intTime   'define variables
intCounter = 1                              'start counter
intDuration = ChnLength("Time")     'set duration
 
For intTime = 1 to intDuration
For intTime2 = intTime2 to intDuration
If ((ChDx(intTime,"y1Channel") = NOVALUE) and (ChDx(intTime2,"y2Channel") = 0)) Then
'something happens here, I had it set to MsgBox ("Hello") for testing because I know that for certain times in my Time channel, I do have NoValues in y1Channel and zero values in my y2Channel.
End If
Next
Next
 
 
0 Kudos
Message 9 of 14
(3,734 Views)
Thanks for the reply.  Sorry about the multiple posts, I actually had a newer updated version of this question that I was trying to post.
 
Thanks for the tip, I was missing the extra pair of "" around my strings.
Call FormulaCalc("Ch(""MyChannel"") := Ch(""MyChannel"") * (Ch(""MyChannel"") >= 0) + NoValue * (Ch(""MyChannel"") < 0)")
 
The other part was
 
My:
Call ChnNovHandle("Time","MyChannel","Delete","XY",False,True)
was not deleting NoValues in my Time and MyChannel channels.
 
and why won't this work?
 
Dim intDuration,intCounter,intTime   'define variables
intCounter = 1                               'start counter
intDuration = ChnLength("Time")     'set duration
 
For intTime = 1 to intDuration
For intTime2 = intTime2 to intDuration
If ((ChDx(intTime,"y1Channel") = NOVALUE) and (ChDx(intTime2,"y2Channel") = 0)) Then
'something happens here, I had it set to MsgBox ("Hello") for testing because I know that for certain times in my Time channel, I do have NoValues in y1Channel and zero values in my y2Channel.
End If
Next
Next
 
 
0 Kudos
Message 10 of 14
(3,733 Views)