04-22-2015 10:47 AM
Hello,
I'm having strange issues trying to read from the following spreadsheet file. I'm using a similar structure for 2 other spreadsheet files and they work perfectly. When I try and use the following VI with the attached data file it just seems to import a load of zeros.
I'm wondering if the issue could be related to the delimiter as the data is not just comma separated values but there seems to be a space directly after the comma i.e. "18.63, 18.23, 17.53" as opposed to "18.63,18.23,17.53".
Can anyone help me with this? I'm just trying to get some temperature sensor data from a datalogger. The data is being written to the spreadsheet continually and I'm just trying to read the most recent value so that I can use it for further calculations.
Thanks in advance,
Barry
Solved! Go to Solution.
04-22-2015 11:31 AM
Your data is filled with null characters. Turn on \codes display on the indicator and you'll see a whole lot of \00 's.
Also has a \FF\FE at the beginning, possibly some prefix for a special file type?
04-22-2015 11:38 AM
RavensFan,
I'm not sure I follow what you're saying. Inside the CSV file the data looks fine to me?
See the below photo:
Also, the front panel when you import the file seems to import the raw data fine and you can clearly see the data. I'm just trying to extract each of the individual elements into double format so that I can display and use them for calculations.
You'll see that none of the data is showing up in "sub array 3" as individual elements. For the other CSV file I use this method seems to work fine?
04-22-2015 11:40 AM
Also, what is the purpose of the while loop and stop button? Does the file contents really change millions of times per second forcing you to re-read the same file over and over as fast as the computer allows?
What was originally used to create that file?
04-22-2015 11:41 AM - edited 04-22-2015 11:44 AM
Right click on your indicator and display \codes mode. You'll see \00 every other character. Even in normal display, the text doesn't look right with "spaces" between every character.
I think it is somehow encoded as unicode. I think that is what the \FF\FE at the front of the file signifes.
Excel is probably reading a unicode CSV file okay. LabVIEW reads it as a straight up "text" file with a bunch of null characters all over the place.
If you use search and replace, to replace the null characters with nothing, it works fine.
See the attached snippet.
04-22-2015 11:45 AM
This file might be in unicode or something. What is the language setting of the computer you are using?
04-22-2015 11:47 AM
The file is being updated once per second by Agilent Bench Logger 3 software that is communicating with an Agilent 34972A LXI Data acquisition unit.
The reason I'm using the while loop is because it was the structure that seemed to work with my previous program. It's almost certainly not the best way to do it but for my needs to worked at the time so I've stuck with it.
In relation to the fix that you suggested - can you give me any solution to how I would implement the functionality that I'm trying to achieve? I basically want to be able to pull each of those individual data elements out once a second as the CSV file is being updated? Do I have to get LabView to delete all of the zeros some how?
Thanks for the help so far,
Barry
04-22-2015 11:48 AM
The langauge setting is ENG UK
04-22-2015 11:54 AM - edited 04-22-2015 11:55 AM
NULL Characters don't show up in normal display mode that's why Ravens Fan told you to switch to code display.
You can do something like this
There is surely a better way to have the latest values than to write to a file and then read back the file to get the latest value. (and put a small wait time in the while loop to slow it down a bit)
EDIT: I missed a lot of replies while typing so sorry for the redundancy!
Ben64
04-22-2015 11:59 AM
@Barry675 wrote:
In relation to the fix that you suggested - can you give me any solution to how I would implement the functionality that I'm trying to achieve? I basically want to be able to pull each of those individual data elements out once a second as the CSV file is being updated? Do I have to get LabView to delete all of the zeros some how?
Thanks for the help so far,
Barry
See the snippet that I attached to my post.