LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple problem writing "#N/A" to a .txt file

Solved!
Go to solution

Hi,

 

I would like to write the string : #N/A in a text file so that when I open the text file whith Excel, those points don't appear on the plot. Whith the VI I have attached, those #N/A points are considered as 0 on the excel plot. Whereas if I write #N/A directly into excel (without using Labview) it works fine. I have only noticed that going through my program "#N/A" apperas on the left of the cell in excel, whereas when entered directly it is centered. I suppose I am using a wrong format or something like that but I can't find the solution. 

Anyhelp would be great,

 

XP & 8.5

 

Regards,

 

Marc

0 Kudos
Message 1 of 10
(3,607 Views)
You have a space before and after the "#N/A" text. Remove them and it should work.
0 Kudos
Message 2 of 10
(3,592 Views)

Just for kicks, try putting a single quote before the #N/A in the string constant. 

The single quote makes Excel consider it a text entry the way you get when you type it in.

 

Jim

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 3 of 10
(3,584 Views)

Hi Smercurio and JCarmody,

 

First thank you for answering my question.

 

1°)Concerning Smercurio, deleating the space before #N/A in the text file makes it work. But I would like to avoid doing this each time, and just being able to write directly the correct expression from Labview.

 

2°)Concerning JCarmody, I had already tried putting eather  " or ' signs before #N/A in Labview, and making sure I am ticking the correct option in Excel when I open the .txt file, but this doesn't work. I get "#N/A or '#N/A in the cell, but it is still consired as 0 on the plot.

 

Regards,

 

Marc

0 Kudos
Message 4 of 10
(3,556 Views)

Hi Marc,

 

Have you try to open your text file with Excel 2007 ? what version do you have ?

 

Regards,

Steve M.
0 Kudos
Message 5 of 10
(3,523 Views)

Hi Steve,

 

I am opening the text file with Excel 2000.

 

Marc

0 Kudos
Message 6 of 10
(3,520 Views)

Do you open your .txt with the Excel Text Import Wizard ? See here to use it efficiently http://www.robelle.com/tips/st-export-excel.html

http://www.uic.edu/depts/accc/seminars/excel2000-intermed/import.html

also I invite you tu use this tool  http://www.beside.com/index.html

 

I hope it helps.

 

Regards,

 

Steve M.
0 Kudos
Message 7 of 10
(3,498 Views)
If you want to create the correct string in LabVIEW, you should use the Format Into String correctly. All of the concantanation is totally unneccesary. Wire the date and time into it and use a format string of "%s\s%s\t#N/A\r\n" with '\' Codes Display turned on.
Message 8 of 10
(3,484 Views)
Hi Dennis, Your solution works fine thanks. My text value can either be a numeric value converted to text or #N/A when I don't get any value from my instrument. Does this mean I have to use a  condition structure where I have 2 possibilities (see attached VI that works) : 1) My value is #N/A, I use a format to string Icon, whith the format "%s\s%s\t#N/A\r\n"2) my value is 35 for instance (in a string format), I use a format to string Icon, with the format "%s\s%s\t%s\r\n" and I wire my value to the correct entry of the format to string icon 

Is this correct, or is there a simpler way to reach my purpose?

 

Marc

0 Kudos
Message 9 of 10
(3,449 Views)
Solution
Accepted by topic author marc france

I would use the Select function and a single Format Into String function.

 

Message Edited by Dennis Knutson on 11-07-2008 08:02 AM
Message 10 of 10
(3,418 Views)