LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write matrix to ascii file?

Solved!
Go to solution

Hi!

 

I want to write a matrix to an ascii file in the following way, first a given head line, then n measurements:

 

151718..etc..

x10x20x30........

x11x21x31........

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

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

x1nx2nx2n........

 

Which is the easiest and most efficient way of reading and writing this to an ascii file?

 

Sorry if this already answered, thx for any help anyway!

BR!

 

0 Kudos
Message 1 of 5
(3,342 Views)
Solution
Accepted by topic author mkkribor

Are you actually dealing with a matrix?  Or are you using an array?  Even if it is a matrix, you shold be able to convert it to a 2-D array.

 

Then you can use Write to Spreadsheet File to write the 2-D array to a file.  Use whatever delimiter you like (is it "n" or "x" in your example?) at the top connector of the Write to Spreadsheet File VI to separate the elements within a given row.  The rows will be separated by a linefeed character.

0 Kudos
Message 2 of 5
(3,337 Views)

Sorry, I see my example came out wrong. I meant:

15('C)        17('C)           19('C)            ...........

x1             y2                z3                ........

x2             y3                z3                .........  and so on where x, z and y are the measurments for each degree.

 

So if I format it into 2d-array where:

1.array -> 15('C) x1 x2 x3 .......

2.array -> 17('C) y1 y2 y3 .......

 

Then if I use a "write to spreadsheet file", what do i write in the format string?

0 Kudos
Message 3 of 5
(3,328 Views)

 

Whatever format you want the data values to be.  For instant, with 2 decimal places, %.2f.

0 Kudos
Message 4 of 5
(3,317 Views)

Thx!Smiley Happy

0 Kudos
Message 5 of 5
(3,304 Views)