LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquired data to spreadsheet file

Hi to all,

       I Created a vi that display the values from the acquisition device and i tried to save the acquired data in a spread sheet file but it displays the first 10 values repeatedly for every each 10 steps did i miss something here? i have attached a vi to this

Regards,

Dinesh

0 Kudos
Message 1 of 7
(3,031 Views)

You keep adding data onto a shift register every time, so you will re-write values. For example, with a single sample you are doing this:

1

1, 2

1, 2, 3

1, 2, 3, 4

Can you move the file I/O outside of the loop?

0 Kudos
Message 2 of 7
(3,027 Views)

I would read the data as waveforms instead of 2D array of doubles and use the Export To Spreadsheet File.vi from the Programming->Waveform->Waveform File I/O palette.

 

Ben64

0 Kudos
Message 3 of 7
(3,011 Views)

i just did as you said but it was not working, how exactly i have to do it make it work

0 Kudos
Message 4 of 7
(2,989 Views)

Please show what you tried and explain how it is not working.

 

Ben64

0 Kudos
Message 5 of 7
(2,982 Views)

I have attached you a vi that i made change here, when i put the write to spreadsheet file.vi outside the while loop it was displaying it, or am i doing in a wrong way?

0 Kudos
Message 6 of 7
(2,950 Views)

Did you read Ben's earlier post?  Read it again.  Notice he suggests changing your DAQmx Read function!!!  You chose not to do that (which is OK), but his comment was an attempt to help you by having you follow the most important part of his advice!

 

As I look at your VI, I see the following (feel free to correct me if I have missed something):

  • You are acquiring 10 samples continuously from N (?) channels at 100 Hz, so your Sampling Loop runs at 10 loops/sec (10 Hz).
  • You accumulate all of the samples in an ever-growing Array that you build within the loop.
  • When everything is done, you open and write a Delimited Spreadsheet File, first transposing the array that you have built.
  • There is no indication of how long the loop runs (or, equivalently, how big the final array grows to be).

 Look closely at the Write Delimited Spreadsheet function (I'm using the current name).  Do you see (and understand) the importance and usefulness of the Append to File input?  Do you see (and understand) the meaning of the Transpose input?

 

Think about breaking up your file I/O into three parts:

  1. Open the file and write the Column Headers (Row 1).
  2. For each loop, write only the new data into the same file in row format (the Transpose? input might be useful to think about).
  3. When you exit the loop, close the file.

Now ask yourself -- do you need the Shift Register to hold all of the Array data?

 

The only (potential) downside with this design is that writing the new loop data into the spreadsheet takes place inside the loop.  But you basically have a tenth of a second to write a few tens of numbers to a file -- should be no problem.

 

Bob Schor

0 Kudos
Message 7 of 7
(2,934 Views)