LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Filter string into an array

Solved!
Go to solution

Hi, I am trying to filter 'string in' so the information will be separated into a table (1D array). So in this string MESSAGE will be in its own column, time will be in its own, date as well and then the rest of the information in the final column. 

Does anyone know how to do this ?

 

Kind regards 

Hraym

0 Kudos
Message 1 of 7
(670 Views)
Solution
Accepted by topic author hraym2004

Hi hraym,

 


@hraym2004 wrote:

Hi, I am trying to filter 'string in' so the information will be separated into a table (1D array). So in this string MESSAGE will be in its own column, time will be in its own, date as well and then the rest of the information in the final column. 


You can use SpreadsheetStringToArray to separate the substrings by the Tab delimiter.

When time and date should be located in their own columns then you need to split them at the SPACE delimiter…

 

You can also hard-code your requirement:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(667 Views)

Thank you for the response,

Would you be able to make the code yourself and show me. I am still new to Labview so still trying to wrap my head round certain stuff.

 

Kind regards,

Hraym

0 Kudos
Message 3 of 7
(662 Views)

Let's assume that your string display is set to \-codes. Is it?

What are the fields you want? Are the delimiters all tabs or is there a mix of tabs and spaces?

 

Typically :"spreadsheet string to array" might do what you want. <tab> is the default delimiter.

 

altenbach_0-1708358205901.png

 

 

Message 4 of 7
(621 Views)

Morning,

 

I have tried to do this myself now but keep getting stuck.

I need to filter all the text files from the folder into a table where the data is split up. So Status/Message in first column, date and time in second, then any further information in the third column.

I need a row in the table for each line in the text file.

The end goal is to use the time and dates to work out the elapsed time that this machine was running for each day so I will have to change the date and time into Labview times as well and do the calculation.  

Does anyone know how to code a program to achieve this ?

 

Kind regards,

Hraym

0 Kudos
Message 5 of 7
(566 Views)

Sorry I did not realise the text files were not attached. 

Please find attached 2 text files. There is more than these 2, but these will be enough to give you an idea of how they are formatted

 

Kind regards,

Hraym

Download All
0 Kudos
Message 6 of 7
(563 Views)
Solution
Accepted by topic author hraym2004

In general something like this should work for your particular data, because they already tab-delimited:

snippet2.png

Message 7 of 7
(521 Views)