LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving and averaging with 1D and 2D aray, DAQ

Solved!
Go to solution

 I wish to develop a VI with following attributes:

1. Read file and store real-time values with time value together

Number Time  Channel1  Channel 2 average value

0

1

2

3

4

so on

2. The data average every tenth value and give the result in the same file

3. Another file is also created bysampling every tenth value

I have tried to develop the VI but I can get the value of AO value but I am uanble to average it & sample it or shows only one value.

 

 

0 Kudos
Message 1 of 8
(2,801 Views)

The VI in the last post is incorrect. Please refer to the attached VI.

Please suggest me how can I modify my VI.

0 Kudos
Message 2 of 8
(2,796 Views)

Your only getting one value because that is all you are collecting in the loop, over and over again.  Nothing gets written to your spreadsheet file until the loop stops, at which point only the data collected on the last iteration is passed out of the loop tunnel and to your Write Spreadsheet File VI.

 

You need to write the data to the file inside the loop, or use a producer/consumer architecture to send the data to another loop for processing and/or saving.

 

I'm not sure why you are writing data to a file and then immediately reading it again.  Why not just use the wire that going into the Write Spreadsheet File function.  Also, it is not a good idea to name a text file .xls.  The .xls extension means it is an Excel file.  What you are creating is actually a plain text file with enough formatting of delimiters and row breaks so that it looks somewhat like a spreadsheet if you opened it in a text editor like Notepad.

Message 3 of 8
(2,790 Views)

Thank you for your reply.

I will re-modify using producer consumer loop.

Now after studying many VIs I have developed my new VI which has sampling time value but I am unable to average. It just gives last value. I applied the shift register I am unable to understand.

Also I want to average every 100th value and I want see the average in the same excel file, in other column.

I wish to capture the files in excel format.

0 Kudos
Message 4 of 8
(2,784 Views)

This is updated VI which I modified. But still I am unable to do the average of every 100th element and I wish add as column in the same excel file.

0 Kudos
Message 5 of 8
(2,776 Views)

You might want to look at the Mean pt by pt function under Signal Processing >  Pt by Pt > Prob & Statistics palette.  Set your sample length to be 100.  You can create a counter using a shift register to keep track of the number of samples and to determine when to write the data to the file for every 100th sample.

 

You say you "applied a shift register", but neither of your latest VI's shows a shift register.  If you aren't familiar with shift registers, then you need to take some LabVIEW tutorials.  They are a basic, but important concept.

LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 6 of 8
(2,766 Views)

Thank you for the LV intro.

I modified my VI but still not able to attain the average of 100th value of each channel in the same excel file.

Please see the attached!

0 Kudos
Message 7 of 8
(2,753 Views)
Solution
Accepted by topic author KRAZE4LV

Thanks!!!!!!!!!I used the case structure to solve the problem.

0 Kudos
Message 8 of 8
(2,730 Views)