LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CSV stops saving if the CSV file opened

I used the Write CSV file to save the data. When I open the saved CSV file during the measurement to see the collected data, it stops saving the data. Even if I close the CSV file, it does not save the data anymore.

 

What would be the reason?

 

Thanks

 

0 Kudos
Message 1 of 10
(1,299 Views)

Maybe the program reading the file blocks write access to the file.

0 Kudos
Message 2 of 10
(1,274 Views)

What did you open the CSV file in?  I know Excel will lock the file so you cannot write to the file anymore.  I will often look at data files while tests are running using Ultra Edit or Notepad++, which do not lock the file and will even give you the option to reload.


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 10
(1,233 Views)

Hi,

 

In Windows you can open a file as 'read-only'

If a file is opened in this way another application can still write to the file.

 

If you don't want to create it yourself you can use UltraEdit to view a file and still leave it open for additional writes by another source.

UltraEdit also detects if a file is changed.

 

Kees

 

Seems like Crossrulz uses the same tools ☺

0 Kudos
Message 4 of 10
(1,231 Views)

@inst_soleil wrote:

I used the Write CSV file to save the data. When I open the saved CSV file during the measurement to see the collected data, it stops saving the data. Even if I close the CSV file, it does not save the data anymore.

 

What would be the reason?

 

Thanks

 


The reason is Windows (like any operating system) will only allow one program to have a file open for writing at a time.  

 

If another program tries to open a file for read/write access it causes a Sharing Violation 

 

If you must open a file while your LabVIEW program has it open, you can only open it in Read Only mode or copy the file and open the copy.

========================
=== Engineer Ambiguously ===
========================
Message 5 of 10
(1,215 Views)

I would probably try to use report generation toolkit if I wanted to look at the data while the test was running.

 

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 Chronicles 7:14 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Message 6 of 10
(1,170 Views)

Why aren't you getting an error about this?  Are you implementing error handling?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 10
(1,126 Views)

@GRCK5000 wrote:

I would probably try to use report generation toolkit if I wanted to look at the data while the test was running.

 

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 Chronicles 7:14 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Actually I would stay as far away from proprietary formats like MS Word/Excel.  It seems like every time MS Office gets updated, something breaks in the RGT.🤔

 

Also, you don't need any special application to read a CSV file.  Any text editor will do.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 8 of 10
(1,124 Views)

Ordinarily, when you open a file to read or write to it, you "lock" the file so that only your read (or write) can take place -- no-one else can open (and potentially mess with) the file you are using.  In addition, reading (or writing) a file has three steps -- Open the file, do as many reads (or writes) as you want, then Close the file.

 

The Delimited Spreadsheet VIs behaving differently, especially Write, which does the following:

  1. Opens the file.
  2. (Optionally) goes to the end of the File (otherwise, it starts at the front).
  3. Writes whatever you tell it to write.
  4. Closes the file.

So mixing Reading and Writing Delimited Spreadsheet files is almost guaranteed to give you "something you didn't predict" and (for free!) "something you don't want".

 

Bob Schor

 

 

Message 9 of 10
(1,118 Views)

Dear All,

 

Thanks for all the responses, and sorry for being late to reply. I was away f rom work for a while.

 

It is true that the answer is reading the file from two different sources during the measurement. I know that I was saving the data in DAT format and I didnt have such an issue.

 

Cheers

i

0 Kudos
Message 10 of 10
(935 Views)