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
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
need to use the rounded value to show on summary results
right now im using this functions to round and display the results
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
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.
Solved! Go to Solution.
For quantities with units you have to use the "Round ( )" function - note the capital "R"
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.
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
😞
but thanks!
For quantities with units you have to use the "Round ( )" function - note the capital "R"
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.
perfect!
thanks Werner
this is very helpful.