LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Split the information within each element of an array in LabVIEW

Solved!
Go to solution

Hello Everybody

I need to resolve some code in Labview.

I have a spreadsheet with many (100,000) lines, and in each line i have this kind of info: 

0.00004     0.576

0.00003     0.876,

0.00005     0.896,...

etc.

I can split the spreadsheet in lines as a first step and this is ok.

The next step is to split the information within each line in 2 arrays.

For ex:

Array 1           Array 2

0.00004          0.576

0.00003          0.876,

0.00005           0.896

............            .........

Please see in attach the vi.

Can someone help me?

Cheers

0 Kudos
Message 1 of 15
(3,484 Views)

Use Index Array.  Drag the bottom border downwards to get two outputs.  You'll want to wire a zero constant into the Column index of the upper one so that you'll get column 0 in the first output, and column 1 in the 2nd output.

 

Array manipulation is a basic LabVIEW skill you need to learn early on.

I would recommend you learn more about LabVIEW from here. How to Learn LV

0 Kudos
Message 2 of 15
(3,453 Views)

First replace all "\n\s+" with "\n", and all "\s+" with "\s" (use Search and Replace String twice, set it to regular expression). That would simplify using Spreadsheet String To Array. You'll now have a spreadsheet string with "\s" between columns and "\n" between rows. Just as Spreadsheet String To Array likes to have it.

 

You might remove the comma's with the first replace. So don't replace "\n\s+" with "\n", but replace ",?\n\s+" with "\n".

 

Spreadsheet String To Array should have a 2D input. Then the separator should be a \s. The second dimension uses \n as separator by default (and can't be changed).

 

Then use Index Array to get the desired row or column.

0 Kudos
Message 3 of 15
(3,427 Views)

Hello Revans

Thank you for your reply.

In the way you are proposing me, I get only elements of array. I can't proceed manually for 100,000 elements.

Once again. My array is :

000000  123000

002000  124000

003000  125,000

............  ............

100000  200000

 

What I need to do, is to get from the main array 2 subarrays as follow:

Array 1

000000 

002000 

003000  

............  

100000 

then

Array 2

123000

124000

125,000

 ...........

200000

 

Can someone help me to solve this thing

0 Kudos
Message 4 of 15
(3,426 Views)

Hello

I haven't got results.

Please can you make it the code.

 

All I need to do is:

Hello Revans

Thank you for your reply.

In the way you are proposing me, I get only elements of array. I can't proceed manually for 100,000 elements.

Once again. My array is :

000000  123000

002000  124000

003000  125,000

............  ............

100000  200000

 

What I need to do, is to get from the main array 2 subarrays as follow:

Array 1

000000 

002000 

003000  

............  

100000 

then

Array 2

123000

124000

125,000

 ...........

200000

 

Can you help me on this issue.

Best Regards

0 Kudos
Message 5 of 15
(3,419 Views)

wiebe@CARYA wrote:

First replace all "\n\s+" with "\n", and all "\s+" with "\s" (use Search and Replace String twice, set it to regular expression). That would simplify using Spreadsheet String To Array. You'll now have a spreadsheet string with "\s" between columns and "\n" between rows. Just as Spreadsheet String To Array likes to have it.

 

You might remove the comma's with the first replace. So don't replace "\n\s+" with "\n", but replace ",?\n\s+" with "\n".

 

Spreadsheet String To Array should have a 2D input. Then the separator should be a \s. The second dimension uses \n as separator by default (and can't be changed).

 

Then use Index Array to get the desired row or column.


Labview
Hello

I haven't got results.

Please can you make it the code.

 

All I need to do is:

My array is :

000000  123000

002000  124000

003000  125,000

............  ............

100000  200000

 

What I need to do, is to get from the main array 2 subarrays as follow:

Array 1

000000 

002000 

003000  

............  

100000 

then

Array 2

123000

124000

125,000

 ...........

200000

 

Can you help me on this issue.

Best Regards

0 Kudos
Message 6 of 15
(3,415 Views)

Where do you get stuck?

 

Post your new attempts.

 

If we start making code for everyone, this forum would soon change from Q&A to Do This Do That. It would also cost me\us too much time. This is basic stuff, I think we do you a favor when we let you try this yourself. Teach you to fish, not hand over the fish, if you will.

0 Kudos
Message 7 of 15
(3,406 Views)

Hello

I have tried several time but I don't have results.

Can you help me please.

Cheers

0 Kudos
Message 8 of 15
(3,403 Views)

Step 1:

Use Search And Replace String (ctrl+space, enter Search and Replace).

Right click it, select regular expression.

Wire the input, and the reg.ex. and the replacement string.

Post your findings, let us know where you fail.

 

Step 2:

Do this twice.

Post your findings, let us know where you fail.

 

Step 3:

Wire the result to Spreadsheet String To Array.

Change the Delimiter to \s.

Wire a 2D string array to it, that's what you want.

Post your findings, let us know where you fail.

 

Step 4:

Use the resulting 2D array and Index Array to get the result.

Post your findings, let us know where you fail.

 

It should look like this:

Array String To Array.PNG

 

0 Kudos
Message 9 of 15
(3,397 Views)

Slight improvement (spaces at the beginning gave error):

Array String To Array.PNG

 

Less code, more complex reg.ex.

 

 

0 Kudos
Message 10 of 15
(3,391 Views)