Complete the following steps to convert a number into a string using the Format Into String function.
Select the digital control from the Controls»Numeric palette and place the control on the front panel.
Select the string indicator from the Controls»String & Path palette and place the indicator on the front panel.
On the block diagram, select the Format Into String function from the Functions»String palette and place the function on the block diagram.
Right-click the Format Into String function and select Edit Format String to display the format string in the Edit Format String dialog box. Use this dialog box to create the format string, which specifies the format, precision, data type, and width of the converted value.
From the Selected Operation pull-down menu, select Format fractional number.
Select Right justify from the first Options pull-down menu and Pad using spaces from the second Options pull-down menu.
Place a checkmark in the Use specified precision checkbox in the Options section and type 4. Press the <Enter> key. The Corresponding Format String field should now contain %.4f. This entry converts the number in the digital control into a string with four digits after the decimal point.
Click the OK button. The function creates a string constant and wires it to the format string input.
Use the Wiring tool to wire the numeric control you created in step 1 to the Input #1 input of the Format Into String function.
Wire the string indicator you created in step 2 to the Output String output of the Format Into String function.
Return to the front panel and run the VI. Notice that the string indicator displays a number with four decimal places.
You also can use the specialized functions in the Functions»String»Additional String to Number Functions palette to convert between numeric and string representations.