02-21-2019 08:19 AM
Hello, Could someone help making waveform chart vi more efficient. I'm collecting 8 channels of data. In order to use the waveform chart I have to rebuild each wave form with the get date/date. All eight points are collected simultaneously but using the attached vi Its making a timestamp for each of the 8 data points if you export to excel. Seems like a waste collecting a timestamp for each piece of data but it's the only way I could get it to work. Anyway is there an easier way to make this more efficient or clean it up. I only need to collect points every 2 seconds or so. Thanks in advance.
02-21-2019 08:31 AM
02-21-2019 08:45 AM
Either you don't quite understand Waveforms and Sampling or I don't quite understand what you are doing! Here are some comments:
Bob Schor
02-21-2019 09:00 AM
@Bob_Schor wrote:
Either you don't quite understand Waveforms and Sampling or I don't quite understand what you are doing! ...
Waveform Data types for charts are my preferred method of plotting data. They are great when we are trying to plot data coming in under hardware timing vs devices that are polled via serial. They support equally spaced samples using the Y-array and the "dt" value along with arbitrarily spaced samples.
Just my 2 cents worth,
Ben
02-21-2019 09:09 AM
Thanks Gerd,
Your example absolutely cleans things up and will help much. However, when I export the chart to excel I still get a time and date stamp for each of the 8 columns of data.
02-21-2019 09:13 AM
Thanks Bob,
The array to cluster function can help also. But when I export the chart (strip chart) to excel I want want column of date and time and then eight columns of data.(right click on chart - export to excel) Is there a way to do this with offset and multiplier to get time and date?
02-21-2019 09:19 AM
Let me guess...
You are using the chart right-click option to export to Excel?
In theory all of those time stamps could be different so including a time stamp for each sample is the better method.
If that really bothers you then read the data from the Chart History and write the data in the form you desire.
Ben
02-21-2019 09:24 AM
Thanks Ben,
Yep, that is correct
It looks like that is what I will have to do. Appreciate the help.
02-21-2019 12:15 PM
Hmm -- I've never tried Export to Excel. When I cobbled up a simple example, to my shock and surprise, it really opened Excel! Of course, nothing was written, and the usually-wonderful LabVIEW Help was curiously silent on the Export property, but I'd probably not do it this way, anyway.
What I'd suggest is to optimize the output file by writing it myself. To get all of the Timing Information from data in a Chart, you need only two times -- the time (conventionally called t0) that gives the time that the first point was acquired (and can be saved in any format you want/need, including a Date/Time Timestamp, or simply 0 if the date and time the data were acquired are not important), and the sampling time, or time interval (conventionally called dt). Once you have this, you have the times for every data point -- data point "i" (where the first point is at i = 0) is associated with time t = t0 + i*dt. Hence you write a header with t0 and dt, then you write an array of channel data for every sampled point, without bothering to write t.
This gives you an "efficient" data set, with minimal redundancy. If, for some reason, "time" is really important (i.e. you are "listening" to a grandfather clock and want to know if the Chimes come at the quarter hours, and if the hour chimes are the correct number), you can always generate a file with a Date Column, a Time Column, and multiple Data Columns (but then you have to parse those extra columns which will have a different format, almost surely, from the Data Columns, what a mess ...).
Bob Schor
02-21-2019 05:34 PM
Thanks Bob,
I have a 16 channel system that already writes to a text file and has a date column and time column along with 16 data columns without a strip chart. I figured I put a strip chart in the vi to improve it and noticed the export to excel. I made up a quick vi by GerdW recommnedation and it does export to excel when I right click. Both vi and excel data sheet attached. Gerdw's recommendation will clean up the larger vi but still produces a date/time stamp for each data point.
The reason why the date and time are important is because this data needs to be correlated to other unrelated events that are also date/time stamped. If I have to live with a date/time stamp for every column of data I can live with it.