LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string or hex number split/divide in same number.

Solved!
Go to solution

hello thanks,

I have to compare three decimal numbers(n1,n2,n3) separately with one number(N)outside of case. If it is less than the other number number then inside the 1st case the both number (N/n1)*constant number, then it will compare N with n2 outside and inside case (N-n1/n2-n1) at last inside the case (N-n3/constant-n3).

 

N= main number which will compare with three numbers separately

n1=1st number 

n2= 2nd number 

n3= third number 

 

i tried something but its not working. image is attached 

0 Kudos
Message 11 of 27
(657 Views)

In short, if the comparison is true (N is less than n1, N is less than n2 or N is less than n3 ) the next condition should execute in the case structure.

 

Thank for inputs 

0 Kudos
Message 12 of 27
(642 Views)

 


@newmemeber123 wrote:

In short, if the comparison is true (N is less than n1, N is less than n2 or N is less than n3 ) the next condition should execute in the case structure.

 

Thank for inputs 


Use "built array" of the thee elements in order [n1,n2,n3] and compare it with N. Use "or array elements" to get the condition.

 

Message 13 of 27
(624 Views)

showing error to compare with built array. image is attached. 2nd image is which im trying what crassrulzzzz suggested. am i doing right?

0 Kudos
Message 14 of 27
(613 Views)

N and all other numbers should be scalar. Why are they arrays?

 

(Please attach your VI, truncated images are not useful)

 

altenbach_0-1656682643108.png

 

0 Kudos
Message 15 of 27
(596 Views)

hi,

i tried it  but getting wrong value now. also running out if ideas so did not designed condition 4 in here in VI.

N is main number here so.  so i want to do is.

If N<n1 = condition 1

elseif

N<n2 = condition 2

elseif 

N<n3= condition 3

else 

condition 4

stop

0 Kudos
Message 16 of 27
(596 Views)

@newmemeber123 wrote:

hi,

i tried it  but getting wrong value now. also running out if ideas so did not designed condition 4 in here in VI.

N is main number here so.  so i want to do is.

If N<n1 = condition 1

elseif

N<n2 = condition 2

elseif 

N<n3= condition 3

else 

condition 4

stop


So, if we start with Altebachs example and replace Or Array elements with Boolean Array to Number we can drive the case off the integer.  Case "4..." will execute anytime N>=n1.  Case "2, 3" will execute when N<n1 and N>=n2 Case "1" executes N>=n3 only and Case 0,default executes if N < all Array elements.  This is an Exact implementation of the if than else you wrote.  If different things need to happen when N> any two Array elements you may need to define all 8 cases.


"Should be" isn't "Is" -Jay
0 Kudos
Message 17 of 27
(581 Views)

i will try with this vi. and i will get back to you

0 Kudos
Message 18 of 27
(571 Views)

its showing the same error can you show me example ? Im just lost 😞

0 Kudos
Message 19 of 27
(565 Views)

@newmemeber123 wrote:

its showing the same error can you show me example ? Im just lost 😞


Th

Array logic.png

is is what was described



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 20 of 27
(552 Views)