ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How count a specific values

Hi, i am trying to count how many times a specific values appears in my data, for example: in my data the value changes between '1', '2', '3', '4', '5', '6', and I want to know how many times the value 3 hat appeared. Do you have any idea with which function can I analysis it, thanks!

 

waldy

0 Kudos
Message 1 of 4
(4,782 Views)

Top of my head here.

 

Have you tried Analysis>Statistics>Histogram Classification. That should give you a good starting point for counting your events.

 

Regards

 

Matthew

Message 2 of 4
(4,774 Views)

Thank you for your reply.
I think I haven't described my problem so clearly.


What I want is the value appears time period:
e.g. value '3' appears during the time 'A' and keep constant, and there is
no another value appeared during the time 'A', then count value'3' just for
one time; only when the value '3' changed to value '2' or another value, and
change back to value '3', then count value'3' for the second times.

 

With >Histogram Classification get the appears times after every second,
e.g. time 'A' take 10 seconds, and the value was constant with '3',then will get
">Histogram Classification" for 10 times, actually I count here just for one time.

0 Kudos
Message 3 of 4
(4,755 Views)

Ok, I think I have a better understanding of your problem now. How about doing it via a script? Something I made up on the fly:

 

Option Explicit  'Forces the explicit declaration of all the variables in a script.
Dim LoopCount, CurVal, PrevVal, ThreeCount

ThreeCount = 0
PrevVal = 0

For LoopCount = 1 To ChnPropValGet("["&GroupCount&"]/Channel", "length") ' Modify this line for your group and Channel name
CurVal = CHV(LoopCount,"["&GroupCount&"]/Channel") ' Modify this line for your group and Channel name
If CurVal = 3 and PrevVal <> 3 Then
  ThreeCount = ThreeCount + 1
End If
PrevVal = CurVal

Next

Call LogFileWrite(ThreeCount)

 

Regards

 

Matthew

0 Kudos
Message 4 of 4
(4,745 Views)