09-21-2017 05:11 PM
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
Solved! Go to Solution.
09-22-2017 01:38 AM
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…
09-22-2017 06:21 AM
So, round even points up, odd points down?
Or round towards the nearest 45 deg. multiple?
09-22-2017 07:40 AM
@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?
09-22-2017 07:45 AM
@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.
09-22-2017 07:56 AM
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.
09-22-2017 08:10 AM
@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 ???
09-22-2017 08:11 AM - edited 09-22-2017 08:12 AM
Using Quotient&Remainder is tricky with negative numbers... Have you tested that? Negative numbers might not be a requirement, but still...
09-22-2017 08:31 AM
@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.
09-22-2017 08:48 AM
@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.