LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform chart data saving

Solved!
Go to solution

Thanks Bob.

 

In the project I work on, I am using Daq USB 6008 to do the acquisition of two analog signals.

 

At first I developed the program to process the data, and then save the data until then I had no problem, but at work we came to the conclusion that we also need to save the data before being processed.

 

I'm having trouble saving the data in waveform format. The way I did it is generated a vector and at each iteration the data is added just below the last vector. I would like to save the data by generating a new column at each iteration. 

0 Kudos
Message 11 of 18
(2,044 Views)

You don't (quite) have the right idea about the Waveform to Spreadsheet File VIs, particularly the Boolean inputs.  When File I/O doesn't work quite right, it's often a good idea to use the "Engineering Workbench" part of LabVIEW's name to build a small test situation and explore it, say, a For Loop looping three times, generating a Waveform and writing it to a Spreadsheet File.  Remember how to use Shift Registers -- ideal for something you want to be True (or False) the first time, and "the other way" the rest of the times.  Like this:

Test Waveform to Spreadsheet.png

Bob Schor

0 Kudos
Message 12 of 18
(2,032 Views)

I agree with with you. Actually, I tried to find some examples that could show me how to use the Waveform and writing it to a Spreadsheet File, but I did not get find the good ones, I am beginner yet.

 

Thank you for your great advice to use the "Engineering Workbench". I will test it now.

 

Regards

0 Kudos
Message 13 of 18
(2,030 Views)

Hi Bob,

 

I followed your suggestion, but I am still haveing problem to save data for each iteration. I found an example in the Labview help and I learned better how to use the Waveform to Spreadsheet File VIs, but I feel that I need know more.

 

My program is saveing the same collumn of column before wich means that if i have ten collumns I will have 10 collumns with the same values.

I attached the program with the logic that I applied. The program generates 3 files, the file Waveform3 is more important for me, because generates the data columns for each iteration.


Thanks.

0 Kudos
Message 14 of 18
(2,022 Views)

Unfortunately, you didn't completely understand the Write Waveforms to File example.  It was showing you two ways to write Waveform Files, as a Binary file (.dat) and as a Comma-delimited Spreadsheet File (which the exampled called .txt, but which should more properly be called .csv, especially if you change the delimiter from its default <tab> value to a comma).  

 

Here's closer to what you want to do:

Write Waveforms to Spreadsheet.png

I'm building my multi-channel Waveform from two Waveform Generators, am using the .csv extension, and am using Comma as a separator.  I've never used the Waveform-to-Delimited Spreadsheet function before, but it has a bug that I will report to NI, namely it adds a blank space after the second, third, ... append (but not after the first, curiously).

 

See if this is closer to what you want to do.

 

Bob Schor

0 Kudos
Message 15 of 18
(2,017 Views)

Bob,

It still doing the same thing, even that I change from txt to csv. The issue is not acquire multichannel datas and separate the channels by column.

The issue is that I need to separate the datas by each execution the loop for adding a new column. Example, if per each execution the loop for generates 1000 lines of datas, when the loop for execute again the program will need add the new data creating new column with 1000 lines, what create a matrix of 1000 lines fixed with number of columns with the same number of execution of the loop for.

I did it with the last code I sent previously, I will send again with some modifications. If you look the file generated you will see that it will have many columns with the same number of the execution the loop for, but the columns will have the same data, when it should be different each other.

 

I attached another VI (SaveFile.vi) , I got the solution, but it is not the best.
.

0 Kudos
Message 16 of 18
(2,010 Views)

Before you "Confuse Me With the Facts", let me ask a question:

 

     Are you taking continuous data, i.e. sampling 1000 points continuously at 1 kHz so that your data is one long stream, many seconds in length?

 

or

 

     Are you taking multiple sessions of fixed data samples, for example 1 second of data at 1 kHz, then some time later another 1 second of data, and later a third 1 second?

 

Assume you are taking 4 channels of data.  In the continuous case, where you sample for N seconds, I'd think you would want one data record that has 4 columns of data and has N*Sampling Rate rows.  If you are taking "finite chunks" of data, you might want them to be "stacked" horizontally (4 columns, space, 4 columns, space, etc.) or vertically (with vertical space between), with each set of columns having its own header.

 

Note that writing data as one long file is easy, as you write the file "as the data come in".  If you are taking data in "chunks" and want to write it in the "horizontal" format, you may have to acquire all of the data in memory, format it into N sets of columns by R rows, then write it out (possibly with duplicating headers).

 

So please tell me what you are trying to do (don't show me code, nor send pictures -- tell me a story).  Once the data acquisition process is clear, a Data Storage solution should be much easier to discuss.

 

Bob Schor

0 Kudos
Message 17 of 18
(2,004 Views)

Hi Bob,

I am taking multiple sessions of fixed data samples. In my case, I am taking 14 seconds of data at 1kHz, after this 14 seconds, immediately I take 14 seconds of data again and so on succesvily.

 

I trying to take data in "chunks" and to write it in the "horizontal" format.

 

My goal is to save the raw data and then process each section using the labview to improve the signal processing. 

 

I understand that writing data as one long file is easy, but to process this data I would need to separate the data in sections . Would you have any suggestion how to separate a vector in sections to proccess?

 

Thanks for your patience.

0 Kudos
Message 18 of 18
(1,997 Views)