Complete the following steps to convert a number into a string using the Format Into String function.
Add a numeric control to the front panel window.
Add Find
Add a string indicator to the front panel window.
Add Find
Add the Format Into String function to the block diagram.
Add Find
Right-click the Format Into String function and select Edit Format String from the shortcut menu 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 Justification pull-down menu and Pad using zeros from the Padding pull-down menu.
Place a checkmark in the Use minimum field width checkbox in the Options section and type 8. Press the <Enter> key. The Corresponding format string field should now contain %08f. If you enter a number in the numeric control with less than 8 digits, this entry pads the remaining spaces with zeros before the first digit.
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 %08.4f. This entry converts the number in the numeric 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.
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 resulting 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 String/Number Conversion functions to convert between numeric and string representations.