LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write delimited spreadsheet

Solved!
Go to solution

I'm embarrassed to ask this but I'm terribly rusty with LabVIEW

 

If I'm outputting a 2D array into the file (Double precision numbers) Every for loop cycle

1 4
2 5
3 6
Using -write delimited spreadsheet Function

 

I get

1 4
2 5
3 6
1 4
2 5
3 6

After two cycles

 

What I want

1 4 1 4
2 5 2 5
3 6 3 6

 

How do I bring the second cycle back to the top of the file in alignment with the first data set?

 

 

 

 

 

 

 

 

0 Kudos
Message 1 of 4
(89 Views)

If performance isn't a concern, you could read the existing contents of the file, do some transposes, and then append the new array.

 

Darren_1-1759854563499.png

 

0 Kudos
Message 2 of 4
(61 Views)
Solution
Accepted by topic author LED47

You can only append rows, not columns. This is a consequence of the file layout.

 

On disk, the file looks like

 

1 4\n2 5\n3 6\n

after inserting columns, the file looks like

 

1 4 1 4\n2 5 2 5\n3 6 3 6

 

You need to build a larger 2D array in memory by concatenating each cycle’s 2D array horizontally (column-wise), then write the final array to the file once.

 

build array columnwisebuild array columnwise

 

The alternative is to change the file layout. Or rewrite the file each iteration.

0 Kudos
Message 3 of 4
(56 Views)

That's the ticket...

 

Thank you to everyone

 

 

0 Kudos
Message 4 of 4
(39 Views)