LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Equivilant to excel functions?

Solved!
Go to solution

Hi, I'm trying to translate some equations done in Excel into LabVIEW.

Does anyone know what the LabVIEW equivilant is for the Excel command:

ROUND(x,0)

 

Also, what is the equivilant for 

INT(x)

 

Many thanks, Alec

0 Kudos
Message 1 of 17
(4,802 Views)

Here you go:

excel.PNG

 

The top 3 functions, from left to right:
1) Round to nearest

2) Round down

3) Round up

 

The palette below shows all types of numeric type conversions.

To convert to int, you can do I64, I32, I16, or I8

Message Edited by Cory K on 08-13-2009 10:13 AM
Cory K
Message 2 of 17
(4,794 Views)
 I am aware these functions, but I don't think one of those works in exactly the same way as ROUND(x,0) do they.. or do they?
0 Kudos
Message 3 of 17
(4,786 Views)

To be honest, I'm not sure because I dont use excel much.

What exactly does ROUND(x,0) do in excel?

 

Once I know the functionality, I can point you to a better function.

Cory K
0 Kudos
Message 4 of 17
(4,784 Views)

Round Numbers

The ROUND Function will round numbers to a specified number of digits. If the number of digits is negative, it will round to the left of the decimal point. If zero it will round to the nearest Integer (whole number).

=ROUND(1.5,0) will result in a value of 2

=ROUND(1.4,0) will result in a value of 1

Round Numbers Up

The ROUNDUP function will round numbers up, away from zero.

=ROUNDUP(1.4,0) will result in a value of 2

Round Numbers Down

The ROUNDDOWN function will round numbers down, toward zero.

=ROUNDDOWN(1.6,0) will result in a value of 1

INT (although less flexible) can also be used. =INT(1.6) will also result in 1

0 Kudos
Message 5 of 17
(4,778 Views)

If you are going to input the second parameter as 0 : ROUND(x,0)

Then you will want to use round to nearest.

The cutoff with be .5

An odd number will round up, and an even number will round down.

 

Ex:
13.5 --> 14

 

16.5 --> 16

 

11.3 --> 11

 

11.8 --> 12

Cory K
0 Kudos
Message 6 of 17
(4,771 Views)
The Rounds in LabVIEW do not have decimal place inputs, so are equivalent to the ROUND, ROUNDUP, and ROUNDDOWN with the second parameter set to 0.  ROUND is Round to Nearest.  IF you want decimal places, you will have to do your own coding to shift the decimal places and do rounding.
0 Kudos
Message 7 of 17
(4,770 Views)
Solution
Accepted by topic author alecjcook

Matthew Kelton wrote:
The Rounds in LabVIEW do not have decimal place inputs, so are equivalent to the ROUND, ROUNDUP, and ROUNDDOWN with the second parameter set to 0.  ROUND is Round to Nearest.  IF you want decimal places, you will have to do your own coding to shift the decimal places and do rounding.

So Round(x,d) will impement as round.PNG I missed the negate of d on the first shot

Message Edited by Jeff Bohrer on 08-13-2009 11:01 AM

"Should be" isn't "Is" -Jay
Message 8 of 17
(4,754 Views)
Wow, nice job Jeff
Cory K
0 Kudos
Message 9 of 17
(4,748 Views)
Thanks Cory.  pretty basic

"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 17
(4,737 Views)