LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to programmatically convert a 1D array to a Waveform array

Solved!
Go to solution

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

0 Kudos
Message 1 of 6
(2,822 Views)

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

0 Kudos
Message 2 of 6
(2,806 Views)

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

0 Kudos
Message 3 of 6
(2,800 Views)
Solution
Accepted by topic author Collin.Fischels

@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...


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 6
(2,778 Views)

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

0 Kudos
Message 5 of 6
(2,774 Views)

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!

0 Kudos
Message 6 of 6
(2,745 Views)