06-30-2022 12:31 PM
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
07-01-2022 03:33 AM
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
07-01-2022 06:26 AM - edited 07-01-2022 06:50 AM
@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.
07-01-2022 07:24 AM - edited 07-01-2022 07:26 AM
showing error to compare with built array. image is attached. 2nd image is which im trying what crassrulzzzz suggested. am i doing right?
07-01-2022 08:31 AM - edited 07-01-2022 08:37 AM
N and all other numbers should be scalar. Why are they arrays?
(Please attach your VI, truncated images are not useful)
07-01-2022 09:04 AM
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
07-01-2022 09:32 AM - edited 07-01-2022 09:39 AM
@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.
07-01-2022 09:52 AM
i will try with this vi. and i will get back to you
07-01-2022 10:21 AM
its showing the same error can you show me example ? Im just lost 😞
07-01-2022 02:20 PM
@newmemeber123 wrote:
its showing the same error can you show me example ? Im just lost 😞
Th
is is what was described