LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

save txt spreadsheet column

Solved!
Go to solution

Hi all,

 

I have two arrays:

 

1 2 3             5 6

2 5 4    and   7 8

5 6 4

 

and I want to save the two arrays in a txt fil with the 'Write to Spreadsheet File' function to get:

1 2 3 5 6

2 5 4 7 8

5 6 4

 

in the attached file, I tried something but it is not what I want because it put the second array at the bottom of the first array. 

any suggestions?

 

thank you

 

Cedric

 

Message 1 of 5
(2,593 Views)
0 Kudos
Message 2 of 5
(2,581 Views)

Hi apok,

 

If the array are switched, it doesn't work. for example, when the first array is:

5 6

7 8

 

and the second array is:

1 2 3

2 5 4

5 6 4

 

the result is :

5 6 1 2 3

7 8 2 5 4

 

instead of:

5 6 1 2 3

7 8 2 5 4

      5 6 4

 

is there a general strategy to do that?

 

thank you.

 

Cedric

 

 

 

0 Kudos
Message 3 of 5
(2,547 Views)
Solution
Accepted by topic author Cedric51

Try Transpose Array on each input array then wire those arrays into Build Array (Concatenate Inputs) then Transpose Array again.

 

 

0 Kudos
Message 4 of 5
(2,541 Views)

Cedric51,

 

In LV all arrays must be rectangular.  All the rows in an array will be of the same length. Similarly all columns are equal in size to each other.

 

So when combining arrays of different sizes, you must be careful to define exactly what you want in the empty locations. Also many of the array functions truncate to the size of the shorter input arrray.  Read the help files carefully and do some testing to see what you need to do to create the results you want.

 

Also note that all OSes supported by LV write files by rows, so that appending columns or inserting columns is difficult because much of the existing file needs to be moved.  Sometimes it is easier to append rows until all the data is saved, then read in the entire file, tranpose, and write to the final file.

 

Lynn

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