LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

User Input to control number of decimal places

Solved!
Go to solution

Hey everyone,

 

I'm brand new to LabVIEW, and just learning how this all works. I was wondering if there was a way to allow user input to modify the number of decimal places (The output of my function is infinitely repeating). 

 

I tried this, but it didn't work:

 

Using a numeric input, I concatenated a string with "%." + "[INPUT]" + "f" using the number to string functions and the concat strings function. I used the resulting string as the Format String in the format value function.

 

This doesn't work though. The output should be something like "28.274", but instead, it outputs "283f". Does anyone know why? Is there a better way to do this?

 

Also, attaching an image of the block diagram and front panel for clarity.

 

(Yes, this is homework, but the assignment does not include allowing the user to adjust number of decimal places, it's just something I'd like to add.)

0 Kudos
Message 1 of 4
(3,088 Views)

That's an easy one to answer...

 

What is the value for decimal places that you are wiring?  Is it at least 10?

 

Spoiler
OK.. I'll be nice and tell you..  I do expect "D'Oh!"..  LOL!!  You are wiring %. 6f  instead of %.6f 
Spoiler
Again..  you are wiring :  (with \ displayed)  :  %.\s6f instead of %.6f                                                                               D'OH!

 

0 Kudos
Message 2 of 4
(3,071 Views)
Solution
Accepted by TechnoSam

 

Get rid of the number 2 for the width of your number to decimal string.  It is forcing a space in front of a single digit number.  %. 6f is not equal to %.6f.  The format into string doesn't quite understand the first format string.

 

(PS.  It helps if you attach your VI.  That way we can play with what you have rather than trying to recreate it from scratch.)

0 Kudos
Message 3 of 4
(3,069 Views)

Oh. Thanks! Robot Very Happy For some reason I assumed that it required an input on that node.

 

In the future, I will attach the VI. Why didn't I think to just do that in the first place? Anyway, sorry for the stupid question, and thanks for the quick replies. 😃

0 Kudos
Message 4 of 4
(3,055 Views)