cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

round numbers with units

EP_10906526
8-Gravel

round numbers with units

hello,

im trying to get best wey to round numbers with units like 5.123456789 V

 

im using the function round(x)

but shows error for units not compatible

EP_10906526_0-1709233903367.png

 

need to use the rounded value to show on summary results

right now im using this functions to round and display the results

EP_10906526_4-1709234084721.png

 

 

 but this basically remove the units and convert my variable over and over to number and string, to be able to display it as result.

as you can see below

EP_10906526_3-1709234062388.png

 

but i want to show that result is actually 3.33 V 

I also have calculations for current, and capacitance, so I need function to keep different used units.

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:EP_10906526)

For quantities with units you have to use  the "Round ( )" function - note the capital "R"

Werner_E_1-1709241715504.png

Syntax is different compared to the "round()" function - look it up in the help.

The second argument is not the number of decimals but with "Round" you round to multiples of the second argument. So 10^-2 V rounds multiples of 10 mV which is equivalent to two decimals in Volt.

See: Truncation and Rounding Functions

View solution in original post

4 REPLIES 4

Hi,'

Try round with a extra parameter being the number of decimal places

a=round(a,2)

Cheers

Terry

Hello Terry

I tried but still not working

EP_10906526_0-1709238144162.png

😞

 

but thanks!

Werner_E
25-Diamond I
(To:EP_10906526)

For quantities with units you have to use  the "Round ( )" function - note the capital "R"

Werner_E_1-1709241715504.png

Syntax is different compared to the "round()" function - look it up in the help.

The second argument is not the number of decimals but with "Round" you round to multiples of the second argument. So 10^-2 V rounds multiples of 10 mV which is equivalent to two decimals in Volt.

See: Truncation and Rounding Functions

perfect!

thanks Werner

this is very helpful.

 

Announcements

Top Tags