LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I make to display 7 digits in indicator?

Solved!
Go to solution

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

 

0 Kudos
Message 1 of 11
(4,191 Views)

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;)) 

0 Kudos
Message 2 of 11
(4,181 Views)

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

0 Kudos
Message 3 of 11
(4,174 Views)

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

 

Regards,
Srikrishna


0 Kudos
Message 4 of 11
(4,168 Views)

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.

 

Precision.PNG


Regards,


Nitzz

(Kudos are always Welcome;)) 

0 Kudos
Message 5 of 11
(4,161 Views)

Not better. Sorry

0 Kudos
Message 6 of 11
(4,154 Views)

My first solution is better than this both solution because I return 7 digits when the number is positive and also when it negative.

 

0 Kudos
Message 7 of 11
(4,152 Views)

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 valueSmiley Very Happy.Try 123456789 You'll have to add another case for it;)

 

Regards,

Nitzz 

0 Kudos
Message 8 of 11
(4,146 Views)

You right but the number is always fractional in my vi. Smiley Wink

 

Regards,

Laurent

0 Kudos
Message 9 of 11
(4,144 Views)

Two step process:  Determine precision and truncate the input value.

 

FixedDigits.png

 

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.

0 Kudos
Message 10 of 11
(4,116 Views)