LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Savitzky filter: problem writing to file

Hi,
 
I have a very weird problem. I m using a Savitzky Golay filter to smooth some data and I can see the correct filtered data on the graph on the front panel. Now, I want to write this filtered data to a file. So I wired the output of the SG filter to a spreadsheet file. On replotting the file, I notice that the graph that I obtain is identical to the input that I gave to the filter. I have attached some screenshots of the front panels and the replotted graph.
Figure one: Is the input to the SG filter
Figure two: Is the output of the SG filter.
Figure three: Is the waveform that I obtained from replotting the output that I wrote to a file.
Figure four: Is the SG filter and write to file VI screenshot.
 
Can someone please help me out. Its driving me crazy.
 
Thanks and regards.
0 Kudos
Message 1 of 15
(2,867 Views)

You index the output-array of the filter VI before you save it to file. So on the frontpanel you see the whole waveform, but you save only the first value to the file. Another evidendence for this is the messed up x-Axis (time) in the data loaded from your file. The data you see in the file is neither the data before, nor the data after the filter function. You see only the first value of each measurement. YOu have to put a for-loop arround your save to spreadsheet, or better would be to not index the array at all and write the whole array to file. You can use probes to see what I mean.

 

Hope this helps!

 

Andre

0 Kudos
Message 2 of 15
(2,834 Views)

HI Andre,

First of all, sorry about the delayed reply. Had problems accessing internet. I m sorry, but I dont seem to understand what you said. Can you please tell me in more detail?

 

Thanks and regards,

 

0 Kudos
Message 3 of 15
(2,810 Views)
It's really simple. You are not writing the array output to the file. You are writing a single point because you index the first element out of the array. Get rid of the Index Array function if you want to write the array to file.
0 Kudos
Message 4 of 15
(2,804 Views)

Oh ya...it makes sense now! Thanks so much.

I have another tiny question, if i m reading values from a file, how do i modify the VI to start reading the file again, after it reaches the EOF. I dont want the VI to stop or give an error when EOF file is reached.

Thanks and regards

0 Kudos
Message 5 of 15
(2,801 Views)
What do you mean? There is no reason to read the same file more than once if the contents do not change. If you have a separate read program and the file can change when this is running, then with each iteration of your loop, look at the file size. If it's different, do a read.
0 Kudos
Message 6 of 15
(2,799 Views)
I m going to have to do a presentation, where im reading some data from a file, doing some manipulations on them and presenting the processed data. Unfortunately, these data values are too few in number and the data processing is done, before i have time to show the data processing. So I was wondering, if there was a way to continously read from a file, in the sense of read a file, at the eof go back and read contents again. Sounds a little weird, I know.
 
Regards.
0 Kudos
Message 7 of 15
(2,796 Views)
If you just put it in a loop, you can read it as many times as you want. This is assuming you are using the Read From Spreadsheet function.
0 Kudos
Message 8 of 15
(2,794 Views)

Thanks Dennis. Know what you mean.

One last question, how do I clear the XY graph after every 2 minutes of data display. I tried everything, with no use.

Would be great if you could help me out.

Thanks and regards.

0 Kudos
Message 9 of 15
(2,786 Views)
What have you tried? To clear an XY graph, you just need an empty cluster array. For timing it, the elapsed time function connected to a case statement should work.
0 Kudos
Message 10 of 15
(2,783 Views)