LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

want to ignore some points for input

Solved!
Go to solution

Hello guys, 

 

Now I have a control to a port, the range will be from 0 to 360. However, I want to ignore some points. If the value is from 0 to 1, output 1. If from 89 to 90, output 89. If from 90 to 91 output 91. If from 179 to 180, output 179. Just like this way, also do points near 270 and 360.

So basically, it require the value near certain points coerced to a value.

 

Anyway to solve this?

 

Thanks 

0 Kudos
Message 1 of 11
(3,206 Views)

Hi zyb,

 

so sometimes you want to round up and sometimes you want to round down.

Is there any special rule involved?

 

Once you know this rule you can easily create your own VI.

When you have problems with your VI you can attach it here and we will be glad to discuss about your VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(3,161 Views)

So, round even points up, odd points down?

 

Or round towards the nearest 45 deg. multiple?

 

 

 

0 Kudos
Message 3 of 11
(3,142 Views)

@zyb1003 wrote:

Hello guys, 

 

Now I have a control to a port, the range will be from 0 to 360. However, I want to ignore some points. If the value is from 0 to 1, output 1. If from 89 to 90, output 89. If from 90 to 91 output 91. If from 179 to 180, output 179. Just like this way, also do points near 270 and 360.

So basically, it require the value near certain points coerced to a value.

 

Anyway to solve this?

 

Thanks 


What do you do if it is exactly 90 (or 180, 270, etc..) Do you round up or down?

0 Kudos
Message 4 of 11
(3,129 Views)

@jamiva wrote:

@zyb1003 wrote:

Hello guys, 

 

Now I have a control to a port, the range will be from 0 to 360. However, I want to ignore some points. If the value is from 0 to 1, output 1. If from 89 to 90, output 89. If from 90 to 91 output 91. If from 179 to 180, output 179. Just like this way, also do points near 270 and 360.

So basically, it require the value near certain points coerced to a value.

 

Anyway to solve this?

 

Thanks 


What do you do if it is exactly 90 (or 180, 270, etc..) Do you round up or down?


That is another valid point. Specify like this [a..b], (a..b], (a..b) or [a..b), where )\( is exclusive, and ]\[ is inclusive.

0 Kudos
Message 5 of 11
(3,122 Views)
Solution
Accepted by topic author zyb1003

Don't know if this fits all you requirements, but I would start with something like this. You may need to tweak it a little.

 

coerce.png

Message 6 of 11
(3,115 Views)

@jamiva wrote:

@zyb1003 wrote:

Hello guys, 

 

Now I have a control to a port, the range will be from 0 to 360. However, I want to ignore some points. If the value is from 0 to 1, output 1. If from 89 to 90, output 89. If from 90 to 91 output 91. If from 179 to 180, output 179. Just like this way, also do points near 270 and 360.

So basically, it require the value near certain points coerced to a value.

 

Anyway to solve this?

 

Thanks 


What do you do if it is exactly 90 (or 180, 270, etc..) Do you round up or down?


What do you want to do if the value is somewhere else, such as 92, or 112 or 249 ???

0 Kudos
Message 7 of 11
(3,104 Views)

Using Quotient&Remainder is tricky with negative numbers... Have you tested that? Negative numbers might not be a requirement, but still...

0 Kudos
Message 8 of 11
(3,102 Views)

@zyb1003 wrote:

Hello guys, 

 

Now I have a control to a port, the range will be from 0 to 360...

 

 

Thanks 


I'm assuming from the original post that the data will not contain negative numbers.

0 Kudos
Message 9 of 11
(3,091 Views)

@jamiva wrote:

@zyb1003 wrote:

Hello guys, 

 

Now I have a control to a port, the range will be from 0 to 360...

 

 

Thanks 


I'm assuming from the original post that the data will not contain negative numbers.


You are right of course.

 

But let me give that a spin... The port he's controlling (output) has a 0..360 range, the input to the control could be anything 😉 . A x mod 360 would solve it in that case.

0 Kudos
Message 10 of 11
(3,081 Views)