From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Splitting string with regular expression

Hello,

 

Ik have been having problems with solving a part of a program im writing. My input data looks  like this:

 Field    | A1      | 1        | -ve      |        | 11:35:02   |
 Field    | A1      | 2        | -ve      |        | 11:35:05   |
 Field    | A1      | 3        | -ve      |        | 11:35:08   |
 Field    | A1      | 4        | -ve      |        | 11:35:11   |
 Field    | A1      | 5        | -ve      |        | 11:35:14   |
 Field    | A1      | 6        | -ve      |        | 11:35:17   |
 Field    | A1      | 7        | -ve      |        | 11:35:21   |
 Field    | A1      | 8        | -ve      |        | 11:35:24   |
 Field    | A1      | 9        | -ve      |        | 11:35:27   |
 Field    | A13      | 10       | -ve      |        | 11:35:30   |

 

This input comes from an 2D array and by means of two for loops im reducing each row to a string. Now i want to filter these values to place them into a 1D array of clusters. These clusters contain 5 strings for each value. The first value of the input data is not needed and can be thrown away.  

 

 

 

 

 

 

Can anybody help me on how to do this? I was trying with Regular Expressions, but i got nowhere.

 

Thanks in advanced.

0 Kudos
Message 1 of 3
(2,280 Views)

wcm wrote:

This input comes from an 2D array and by means of two for loops im reducing each row to a string.


This sounds like you may be using the Read From Spreadsheet File VI. Is this correct? If not, how is the input a 2D array, and what do you mean using 2 for loops to reduce each row to a string? What were they before?

 

There are several solutions. One simple way is to convert each row to an array by using the Spreadsheet String to Array function. You can then just trim the strings and build up your cluster within the loop.

0 Kudos
Message 2 of 3
(2,273 Views)

A small error on my side i see now. I use a vi to read from Excel (not using the Read From Spreadsheet File). This outputs a 1D file containing all the data with each row in one element. I spliited that document until there was only the input data (as seen in post 1). One row of the input data is one element in the 1D array.  

 

And also wrong was the two for loops, it is one. This to get from a 1D array to a seperate string.

 

Tomorrow i will test your solution (thanx for that). Right now i need to hurry otherwise im locked in for today.

 

0 Kudos
Message 3 of 3
(2,267 Views)