LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Write to File Formatting

Hello everyone, I'm very new to LabVIEW and have only had self teaching experience. I am writing a program for an Agilent 81640A laser and have completed just about the whole thing accept for one part. I cannot get the formatting right in the write to file palette. 

The data im trying to write comes in very small values, and I'm not entirely sure how to work with the limitations of precision in LabVIEW.

In the first picture, the data gets one digit smaller and starts skipping cells when its writing the data. ( %.10f)

The second picture is at (%.9f) and then it doesn't writing all of the data, it stops at E- for example.

The third picture is how I'm writing the data.

I've also tried leaving (%f) but it just skips every line at that point.

 

Any advice?  Thank you in advanced.

Download All
0 Kudos
Message 1 of 21
(3,121 Views)

Try using scientific notation %.9e

or engineering notation %^.9e

0 Kudos
Message 2 of 21
(3,104 Views)

Where are you initially creating that array of strings?  That is likely where your problem is.


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
0 Kudos
Message 3 of 21
(3,100 Views)

I've done it like that before and it gives me the same issues. Although I haven't tried %^.9e so i'll give that a whirl. I'll let you know how it goes.

0 Kudos
Message 4 of 21
(3,097 Views)

I tried it with %^.9e and I got the same issue as the issue in the second picture i posted where it wont write all of the data. 234.56789E-  for example.

0 Kudos
Message 5 of 21
(3,084 Views)

I just noticed that the wire going to the "write spreadsheet file" is pink. That means the data is already formatted as a string so the specifier should be %s

0 Kudos
Message 6 of 21
(3,081 Views)

The string with the X on it is where my data is coming from. I attached a picture

0 Kudos
Message 7 of 21
(3,074 Views)

I've tried it as %s as well.

0 Kudos
Message 8 of 21
(3,072 Views)

The issue is with your device.  You are just outputting whatever it is giving you.  So it is not giving you clean data.

 

You need to take a look at what shows up in the "read buffer" indicator and see if it looks messed up there.

 

You should not be opening and closing the VISA port on every iteration of the For Loop.

0 Kudos
Message 9 of 21
(3,040 Views)

So it is data straight from a serial port.  What instrument are you talking to?  Are you in a noisy environment?  Are your messages longer than 100 bytes/characters?  How exactly is the data coming from the instrument formatted?

 

General comment:  You should not be opening and closing your port every iteration.  Open and configure the serial port before your loop and close it afterwards.  You can do as much reading and writing inside the loop without interruption then.


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
0 Kudos
Message 10 of 21
(3,036 Views)