Software applications developed using LabView are common in industrial environments where massive amounts of data acquisition and data logging are required. In many applications, the data is collected in the form of a text string that contains a variety of information; in such cases, relevant information has to be extracted from the string by splitting the string into many parts. LabView provides built-in string functions that can be used to accomplish this task.
- Skill level:
- Moderately Easy
Other People Are Reading
Double-click on the LabView icon on your computer desktop to launch the LabView program. Click on "New-VI" to create a new LabView program and save it as "stringParse.VI." The new LabView program will be created with two windows: the front panel window and the diagram window.
Click on "View," then "Functions Palette" found on the diagram window "Menu" to launch the "Functions" palette. Drag and drop the "String Subset" function block from the functions palette to the diagram window. The "String Subset" function block has three inputs: input string, offset and length; it has one output called substring.
Right-click on each of the inputs of the "String Subset" individually and click on "Create Control" to automatically create an input control on the front panel window for each input of the "String Subset" function block. The input controls are used by the user to enter the input string that has to be separated into different parts.
Right-click on the output of the "String Subset" function block in the diagram window and click on "Create Indicator." An indicator that displays the extracted string will be automatically created in the front panel window.
Type any string in the "Input String" control. For example, type "part1Parsed." Enter a numeric value in the "offset" control to ignore the first characters in the string; for example, enter the value "5" to start with the sixth character. Similarly, enter a numeric value in the "length" control to set how many characters to capture; for example, enter the value "6" to capture six characters from the string. The combination of these two functions will let you parse a string any way that is useful.
Click on the "Run" button on the "Menu" of the front panel to execute the program. Based on the parameters in the example in Step 5, this will ignore the first five characters of the input string based on the "offset" input and extract the next six characters based on the "length" input. The extracted string "Parsed" will be separated from the "part1Parsed" string and is displayed in the output string indicator on the front panel.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for