06-15-2011 07:02 AM
Hi,
I don't know if it's posible but I want to show 7 digits in indicator, no more but no less.
I try to use digits of precision or significant digits to fix my problem but I can't find the solution.
My problem is when I have 0.000235848 I want to display that 0.000235 and when I have this 1234.56789 I want 1234.567
If possible I want to use "Numeric Properties".
Thanks,
Laurent
Solved! Go to Solution.
06-15-2011 07:20 AM - edited 06-15-2011 07:23 AM
Hi Lagrive,
I don't know whether there is any better way to do it, but this works fine with all fractional numbers. Check out the attached vi. The output numeric indicators precision in the properties should be set to 7. The rest you will understand from the block diagram.
Regards,
Nitzz
(Give kudos to good Answers, Mark it as a solution if your problem is Solved;))
06-15-2011 07:24 AM
Hi Nitzz,
Thank you for your answer, I do that soon but I hope it's possible to find a better way like you say.
Regards,
Laurent
06-15-2011 07:27 AM
hi lagrive,
Actually you can do this in this way:
"Use "Format to string" function and keep the format string input to "%0.9f" and after that use the string subset function with end string value as 8 then it will input string value as 0.000235.Then once again use scan from string function with format string as "%0.6f".Then you will get 0.000235.Check the attachment.This is for 0.00235848 as input.
Thanks and regards,
srikrishnaNF
06-15-2011 07:31 AM - edited 06-15-2011 07:31 AM
Hi,
I think there is not much different from the above attached vi in Srikrishna's example. Attaching the image so that someone can give some suggestions.
Regards,
Nitzz
(Kudos are always Welcome;))
06-15-2011 07:35 AM
Not better. Sorry
06-15-2011 07:39 AM
My first solution is better than this both solution because I return 7 digits when the number is positive and also when it negative.
06-15-2011 07:50 AM
Hi,
That's right. But i didn't know you had already tried this and so I just pointed out a way to do it. You didn't specify that the number could either be positive or negative. And moreover, in all these examples, if the number is not a fractional value, it will give a wrong value
.Try 123456789 You'll have to add another case for it;)
Regards,
Nitzz
06-15-2011 07:53 AM
You right but the number is always fractional in my vi. ![]()
Regards,
Laurent
06-15-2011 03:52 PM
Two step process: Determine precision and truncate the input value.
The truncation (10^{...}) is necessary since you do not seem to want the numbers rounded. If rounding is ok, just use the portion that sets the precision.