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: 

Filter unwanted numbers when changing values

Solved!
Go to solution

Hi,

 

I want to filter unwanted numbers who occur when switch between different values.

 

I have 5 buttons which are all interconnected to disable the others when one of them is activated (using Set/Reset mechanism). The boolean of each button are sent into an array which is converted to an integer. The values I need as numeric outputs are 1,2,4,8,16. When I change values from e.g. 1 to 4, it will be in the sequence of 1 -> 5  -> 4. This is cause by the fact that for a very short time, two arrays are True.

 

In other words, I need to filter out the number 5 and all other values which are not 1,2,4,8,16 and only pass on these values. It also have to work in the opposite direction, e.g. 4 to 1.

 

. Example.png

 

Any thoughts?

/Johan

0 Kudos
Message 1 of 13
(2,932 Views)

Example_VI_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 13
(2,929 Views)
Solution
Accepted by topic author nijohan

...or, this:

 

Example_VI.png

 

This isn't what you asked for, but it does what I think you want, is easier to scale and easier to operate on the front panel.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 3 of 13
(2,927 Views)

The values are indeed used in a case structure. However when any number which is not 1,2,4,8,16 occur, it returns the default case. This is what I want to prevent.

 

I like the solution with radiobuttons, but I'd rather keep my current panel layout with buttons. Thanks though!

 

EDIT: added reply

0 Kudos
Message 4 of 13
(2,924 Views)

Ignore intermittent value.png

This might do.

 

Regards Florian

Message 5 of 13
(2,907 Views)

Can you please explain what you did? I don't recognise the symbol.

0 Kudos
Message 6 of 13
(2,899 Views)

That is a feedback node.  It holds a value and returns it the next iteration.  It works the same as a shift register.  So what Florian did is if you have an invalid number, return the previous number.


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
0 Kudos
Message 7 of 13
(2,891 Views)

Exactly what crossrulz said.

I'm sorry for not explaining right away.

 

Regards Florian

0 Kudos
Message 8 of 13
(2,882 Views)

Thank you both very much!

 

Can't seem to get it to work though. I've made an example VI to illustrate the problem if you're interested. When you switch the buttons you will see that there is an intermediate step to the default case before it shifts.

0 Kudos
Message 9 of 13
(2,873 Views)

Why not use a radio button?  It automatically does the set/reset function and outputs a numeric.

 

Lynn

0 Kudos
Message 10 of 13
(2,860 Views)