LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting specific data from each string parameter in 1d array.

Hello everyone I am new to this community.

I have 1d array of string which i have taken from a CSV file, the array is quiet big its like 1800 parameters in it. I am looking for a technique to extract specific data from each string parameter. for example SLR_D12_RC2_VS7.0_VL6.6_SL1 is one parameter and i would like to extract RC, VS7.0, VL6.6, SL1 from it. Similarly LIN_T_RX_PDF_14V_SL2 is another parameter and i want to extract PDF, 14V, SL2 from it. There are many more parameters like these and the values that i need are separated by _ (underscore).

How would it be possible.

Thank you in advance.

0 Kudos
Message 1 of 5
(3,230 Views)

Do a scan from string with %s_%s_%s .... or a Spreadsheet string to array where the underscore is your delimiter character.

0 Kudos
Message 2 of 5
(3,205 Views)

Hi shahabkhan,

 

use SpreadsheetStringToArray on each of those strings, using the underscore as separator char, to parse each string into an array of strings. Now you can use IndexArray to read the substrings of interest…

 


@Pukhtun_Yum wrote:

SLR_D12_RC2_VS7.0_VL6.6_SL1 is one parameter and i would like to extract RC, VS7.0, VL6.6, SL1 from it. LIN_T_RX_PDF_14V_SL2 is another parameter and i want to extract PDF, 14V, SL2 from it. 

The first example reads substrings starting with index 2 (3rd element), the second example reads substrings starting with 4th substring element. Maybe there is some additional rule to determine the substrings of interest?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 5
(3,200 Views)

Try the suggestions and if you cannot figure it out post your code with the CSV file and we can give more suggestions.

Tim
GHSP
0 Kudos
Message 4 of 5
(3,177 Views)

@RavensFan wrote:

Do a scan from string with %s_%s_%s .... 


Scan From String won't work that way.

 

A "_" is a string, so it will (try to) parse the entire input as part of the first string.

 

Scan From String will only work with "%[^_]_%[^_]_%s", specifying: characters not in set, match exact string, characters not in set, match exact string, string...

0 Kudos
Message 5 of 5
(2,990 Views)