LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String to Array

Solved!
Go to solution

Hallo all,

I had a doubt regarding the conversion of string into a 2D array. I have the following String

Speedyindian1_0-1691654762675.png

I want to seperate this string into a table in which the data before the ``:`` will be in 1 row and data after in another row. I am attaching the programme below. Can someone suggest the changes i need to make in order to do so.

Regards
Speedy

 

0 Kudos
Message 1 of 7
(900 Views)

Hi Indian,

 


@Speedyindian1 wrote:

I want to seperate this string into a table in which the data before the ``:`` will be in 1 row and data after in another row. I am attaching the programme below. Can someone suggest the changes i need to make in order to do so.


What is your "doubt"? I guess you talk about a "problem"…

 

So the items in the string should be transposed when converting to 2D array as you want the "labels" in one row and the "values" in another row?

 

Why do you think you need a loop? (I didn't include the transposing part intentionally…)

 

Best regards,
GerdW


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

Take a look at "String to Array" in openG

0 Kudos
Message 3 of 7
(876 Views)

@nitad54449 wrote:

Take a look at "String to Array" in openG


Not everyone has openG - although, outside of licensing requirements for commercial use, I can't imagine why they wouldn't...

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 7
(863 Views)

Hi Gerd,

Thank you for your reply. This works well. I had another doubt regarding the searching of a particular element, for ex: I need to search for customer name (first row) in the table and display the customer name (second row) as output. As there is no option to search in a 2d array, should i split the array and then do the search? can you help me regarding the same?

Regards
Speedy

0 Kudos
Message 5 of 7
(855 Views)

Hi Indian,

 


@Speedyindian1 wrote:

I need to search for customer name (first row) in the table and display the customer name (second row) as output.


Search the item in the first row data, then use the found index to index the element from 2nd row…

 


@Speedyindian1 wrote:

As there is no option to search in a 2d array, should i split the array and then do the search?


Why do you want to "split" a 2D array? Why not just index the rows using IndexArray?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(835 Views)
Solution
Accepted by topic author Speedyindian1

Not mentioned here, but you probably should use a couple of FOR loops to Trim Whitespace from the array elements.  This will make the searches a lot easier on you.

 

After that, Index Array can be used to pull out the two columns.  Search 1D Array to find the row for the Customer Name, and then another Index Array to pull out the value associated with the customer name.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
Message 7 of 7
(797 Views)