05-01-2018 01:29 PM
Hello,
I am in some need of some help to programmatically change a 1D array of temperature data to a array of waveform for the time stamp aspect (Best way I have found to add a rough time stamp to each channel for when it was scanned.) Each element of the 1D array is a temperature from a separate channel on the data acquisition. (So element 0 in the array is channel 1, element 1 is channel 2, etc.) I have the program working by manually indexing the elements out of the array and making them into a waveform and then building them into an array, but my problem is that the data acquisition can have up to 90 channels active at once and I don't want my code to be extremely long and tedious. I have attached my program in case anyone wants to look at it.
Thanks,
Collin
Solved! Go to Solution.
05-01-2018 02:01 PM
I'm unclear what you mean by referring to a "timestamp". A Waveform represents data sampled at a fixed time interval (dt). It can also include the TimeStamp for the time that the initial element was sampled.
So if your 1D array represents samples equally spaced in time, you can use the Build Waveform function (on the Waveform Palette) to build the Waveform. Wire the 1D array into Y, wire the time interval dt into dt. You can probably leave T0 blank (or fill it in, as you see fit).
Bob Schor
05-01-2018 02:33 PM - edited 05-01-2018 02:44 PM
Hello Bob,
Sorry I worded that a little weird but, I believe that is how I am adding the timestamp as of right now. I was hoping that I could do something with a for loop or something similar to do same thing so I don't have to do this 90 times. The VI I added might help you better understand why I want to automate this somehow, but if its not possible I will continue to do it as it is.
(The VI i added is from the project it will be in so it will be missing some subVIs and controls just ignore them)
Collin
05-01-2018 09:17 PM - edited 05-01-2018 09:18 PM
@Collin.Fischels wrote: I was hoping that I could do something with a for loop or something similar to do same thing so I don't have to do this 90 times.
Then just use a FOR loop...
05-01-2018 09:51 PM
That is weird code, and makes me think that you completely misunderstand Waveforms! It appears that you are creating a "Waveform" with a single sample, with no "dt" (the defining element of Waveforms), and attaching an evolving T0 (the "optional" component). Your Case structure is also strange -- I think it could be replaced with a For loop, but it is still doing very strange things that have little to do with Waveforms.
Why are you building Waveforms when the basic Waveform premise, namely an array of points having a fixed "dt" sampling time between them, is not being honored? What am I missing?
Bob Schor
05-02-2018 02:08 PM
Crossrulz,
Thanks, I tried a FOR loop before posting but made a dumb mistake by putting the "Get time date" in side the loop which was screwing with things!
I'll mark you as the correct solution!