LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Round up to nearest decimal point

Ah, unsorted... sorry, my mistake.



CLA
www.dvel.se
0 Kudos
Message 11 of 19
(1,321 Views)

Hi moderator1983,

 

could you explain what's the purpose of the 3 for loop, why did you choose 999 as input for the shift register, why did you calculate the difference, what's the purpose of the absolute value and why 0 for the input of the 1st shift register?

 

Sorry, I'm a slow learner and I need more explanation to understand.

0 Kudos
Message 12 of 19
(1,287 Views)

@LHX wrote:

what's the purpose of the 3 for loop


Two outer 'For Loops' (with unwired 'N' terminal) helps extracting one point at a time from the 2D-Array (Previous Phase). This concept is known as 'Auto-indexing'.

The third, inner-most loop is used to extract individual points from 1D-Array (Phase) and then each element of 'Phase' array can be compared to individual element of 'Previous Phase' array

 


@LHX wrote:

why did you choose 999 as input for the shift register


The difference between individual points from 1D-Array (Phase) and individual element(s) of 'Previous Phase' array is always gonna be less than 999, I choose 999, to make sure that the output of 'Is less than' operator is always gonna be 'False' for the very first iteration. You can choose any other value, just make sure that the chosen value must be greater than the difference.
Ques 2.png

 


@LHX wrote:

why did you calculate the difference, what's the purpose of the absolute value


The purpose of calculating difference is to determine the separation between two points and considering separation as a scalar quantity, I'm taking the 'Absolute'. This part of code actually determines the closeness of two points.

 


@LHX wrote:

why 0 for the input of the 1st shift register?



I'm initializing the shift register (closest match index) with 0, because before you actually start determining the closet point (element of 'Phase' array), by entering into the inner most for loop, you may assume that its the first element (0 indexed element) is the closest match.

 

 


@LHX wrote:

Sorry, I'm a slow learner.


Don't be, even I'm a slow learner for new things.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


Message 13 of 19
(1,283 Views)

Shouldn't this do the same as the loops?

Round to nearest decimal point.png

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 14 of 19
(1,270 Views)

Yamaeda, the inner for loop could be replace by your solution if you change the Array input to the subtract function for the autoindexed DBL value from the outer loop.



CLA
www.dvel.se
0 Kudos
Message 15 of 19
(1,244 Views)

Hi modertor1983,

 

I just want to ask if there's a simpliest way on rounding up bacause I tried the codes that you gave LHX, from there my output grey scale of my pixel lens is just plain grey although its showing some white color but not fully and it doesnt really shows the black pixels? ><

 

Thanks!

0 Kudos
Message 16 of 19
(1,218 Views)

Hi,

This is my attached vi.

Download All
0 Kudos
Message 17 of 19
(1,211 Views)

@Enriquez wrote:

Hi,

This is my attached vi.


subVIs are missing...

 

Please put all of the code into a zip file.


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 18 of 19
(1,182 Views)

Hi!

Here it is:) Im actually using the version 2009 ><

0 Kudos
Message 19 of 19
(1,171 Views)