LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reading .CVS file by Labview online!!

Actually I have a .CVS file which is being written by a software during the test.(it's a simple CVS file containing 4 columns).
How can i read data in .CVS file in labview simultaneously??( I mean reading data in Labview when the .CVS file is being recorded by another software)

Because I need to do some calculations on these data during the test 

If you need more details please contact me at jtakab1@lsu.edu

Is it possible??

thanks.

0 Kudos
Message 1 of 19
(3,399 Views)
Do you mean .csv, comma separated variable, file? It depends on whether the file can be opened for reading while the other program is writing. If so the answer is sort of yes, but it could get a bit ugly, as once LabVIEW opens the file it will have to keep track of the current pointer to the current end of the data, so that when it goes to read in more it will know where to start. I'm thinking that it can, but ...
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 19
(3,391 Views)
Yeah,, Exactly... What do you think?? Is it possibe??
0 Kudos
Message 3 of 19
(3,379 Views)
As I said, maybe. I have no way of knowing, some applications "lock" a file, others will allow opening for reading. The simplest thing to try would be seeing if you can open the file with LabVIEW File open function under the File I/O, wiring the error out to a error indicator. Then while the other program is running, creating the desired file, run the LabVIEW one, see if you get an error. This isn't a guarantee, one way or the other, but it is what I would try as a first attempt.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 4 of 19
(3,368 Views)

Thank you so much VL-Pro..

could you please show me a link or tutorial or instruction to do that??

 

Thanks in advance

0 Kudos
Message 5 of 19
(3,363 Views)

If you left click on Help in the LabVIEW toolbar and scroll down to Find Examples, you can find "file" examples. All I'm suggesting at this point is a basic experiment to see if we can open the file for reading while the other program has it open. It is pretty basic LabVIEW. I'm just suggesting putting a file open, from the File I/O pallette on the diagram, connecting an error indicator to the error out terminal. Configure the file open as "read only" then while the other program is running, run this vi in LabVIEW, see if it gets and error. You might want to have a file close wired to the file open, although that might be a second part of the experiment. Look at the examples to see how to do the basics.

 

 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 6 of 19
(3,355 Views)

I guess it will become more difficult.....(or may not be possible) and the main reason would be

 

1) Your X application is currently writing to the excel file and you are trying to open up the same file using LabVIEW and LV may throw up an error saying that the file is already in use

 

2) if 1) is possible, then the LabVIEW application must take care not to change the cell position of the excel file being used by the x application becasue the X application might write the data to to this new cell location and you may end up with over writing the data.

 

 

If some how the X application can write the data to multiple files, then you can read the previous file and next file and hence fetching all the data required to perform some analysis on them

 

Regards
Guru (CLA)
0 Kudos
Message 7 of 19
(3,346 Views)

I don't know that it is actually an Excel file, just a comma seperated variable file, which Excel could read (as well as tab delimited, etc.) so the "cell" positions are only defined by where in a text string the values fall. I don't know if LabVIEW will be able to open the file while it is being used by the other, that is what the experiment is for. Of course if LabVIEW can open the file for reading that only is the beginning of the "interesting" issues. Since the file will be added to while we are trying to look at it, we will have to try and keep track of where the last point in the file that we looked at was and in subsequent reads of the file make sure to start reading at that point.

 

If not we may have to get creative!

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 8 of 19
(3,327 Views)

The easiest would be to make a copy of the file, do your calculations and then delete the copied file.  I am not an expert at this, but I have learned that messing with a file that is being written to can be bad.

 

You could also track your position in the file by looking at how many data points are in the file when you open it, and the next time you open a new copy just start where you ended with the last file.  It is very basic and not very sexy, but it should work.  It also might depend on how fast the file is being written to.  If it is a slow data rate you will have plenty of time to copy the file and not interupt the original program.

0 Kudos
Message 9 of 19
(3,322 Views)

thanks all you guys:

 

I tried to read data online by LV_PRO instruction, Unfortunately got an error. (see attached pic 1)

 

to Lv_pro: When I set file to read-only, the original software (DriveView) can not write to file!!(see attached pic 2)

 

what do you propose?

 

Jeff

Download All
0 Kudos
Message 10 of 19
(3,307 Views)