From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

is how can I calculate how many transitions are inside an array?

Solved!
Go to solution

Let’s assume that we have an array of 582 elements. Some of them are above 4 and some of them are below 1,let’s also say that values who are above 4 are equal to True (1) and the values below 1 are equal to False (0). The question is how can I calculate how many transitions are inside the array from 1 to 0?How many peaks I have? Can please someone suggest a code solution for that?

0 Kudos
Message 1 of 8
(2,778 Views)

OpenG toolkit has a function called "Boolean Trigger" that can help you.

 

here's how it works.

 

Example_VI_BD.png

 

hope this helps


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 2 of 8
(2,763 Views)

It looks bit challenging I have tried an Example but am not sure how good it works.

 

Frequency_array.png

 

Good Luck

-----

The best solution is the one you find it by yourself
0 Kudos
Message 3 of 8
(2,761 Views)

P Anand no this not helped., iwant to calculate how many transitions i have from 1 to zero and zero to 1,that's i want to find.i am trying to downloan the toolkit the friend mention to see how it works.Any other solutions please?

0 Kudos
Message 4 of 8
(2,749 Views)

The example I gave in my previous post works on an array of boolean, as I understand you have an array of numeric so you'll have to add some threshold value so it works.

What I suggest is that you try to implement it and if it doesn't work exactly as you wish, post it here and we'll help you to fix it.$

 

good luck


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 5 of 8
(2,742 Views)

If you only care about actual transitions and not the type of them, I'm a fan of the simple XOR.

 

Count Transitions.png


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 8
(2,738 Views)
Solution
Accepted by gtathatos

Yes I have tested the one before now I have tested it I guess this should work. Check it.

 

 

-----

The best solution is the one you find it by yourself
0 Kudos
Message 7 of 8
(2,731 Views)

Quite simple.

 

Norbert

 

EDIT: Hehe, just seen that it is indeed very comparable to crossrulz' approach 😉

EDIT 2: Adding improved example

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Download All
0 Kudos
Message 8 of 8
(2,728 Views)