04-18-2024 09:39 AM
Hello,
I am trying to record data from a NI DAQ USB 6210 connected to a SRS 830. I´ve got some hints from another topic published here (click here: how to append array elements without overwriting? ) on how to do this, so I proceed with a shift register, creating a constant array, and using the "Insert into Array" function. However, instead of having a single array spawning several seconds, I have multiple arrays spanning one second (the DAQ is set to read 1ksamples per second at a rate of 1kHz.)
What am I missing in order to obtain a collated, continuous time vs voltage array instead of this collection of arrays? The images below depict the Waveform Graph with all the collected data (several sets spanning 1 second) as well an overlook of the output array, whereas the second shows the current code pertaining to the data collection.
Any feedback would be most welcome!
Kind regards.
04-18-2024 09:51 AM - edited 04-18-2024 09:52 AM
Hi Flonares,
@Flonares wrote:
so I proceed with a shift register, creating a constant array, and using the "Insert into Array" function. However, instead of having a single array spawning several seconds, I have multiple arrays spanning one second (the DAQ is set to read 1ksamples per second at a rate of 1kHz.)
Because that is what you have programmed!
Your shift register contains an array of waveforms and with each iteration you "insert" even more waveforms into this array! (Btw. don't use InsertIntoArray when you want to build an array. There's a BuildArray function!)
Suggestion:
You read "n channels" from DAQmx and you (most probably) want to append the waveforms for each channel. Why don't you use AppendWaveforms in a loop and have this loop iterate over all those channels?
(Be aware of side effects, like handling the first iteration correctly…)
04-22-2024 03:22 AM
Dear GerdW,
Many thanks for your reply. I tried appending the waveform as you spoke, but I ended up with some errors I don´t fully understand, so I am definitively doing something wrong. Could you provide me with some insight?
Errors:
1) These cannot be wired together because their data types (numeric, string, array, cluster, etc.) do not match. Show the Context Help window to see what data type is required. The type of the source is 1D array of Waveform(DBL). The type of the sink is Waveform(DBL).
2) You have two or more array data types wired together, but the arrays have different numbers of dimensions. Show the Context Help window to see how many dimensions are required. The dimension of is 1. The dimension of Final Waveform is 2.
The last error is somewhat understandable:
3) A For Loop must have a loop count wired to the 'N' terminal, or an array input that has auto-indexing enabled. Otherwise the loop does not know how many times to iterate.
I still need to find out how to pass the number of loops to be executed in order to fully process the waveforms. But I don´t understand how I get a 2D Waveform - since I´m just appending data, shouldn´t it be just a single column?
Kind regards,
Flo
04-22-2024 03:32 AM - edited 04-22-2024 03:34 AM
Hi Flonares,
@Flonares wrote:
I tried appending the waveform as you spoke, but I ended up with some errors I don´t fully understand, so I am definitively doing something wrong. Could you provide me with some insight?
Your FOR loop looks different then mine!
Please check ALL input tunnels: in my suggestion BOTH are set to autoindexing!
(You cannot append an array of waveforms to an existing waveform using the WfmAppend function!)
It also doesn't make sense to append waveforms to a constant "empty waveform"! You need to use a shift register to store your waveforms for the next iteration.
As this is basic LabVIEW knowledge: please take note of those Training resources offered at the top of the LabVIEW board!
04-22-2024 05:58 AM
But the shift register needs to be initialized, correct? So how would I properly initialize it?
Kind regards,
Alcides
04-22-2024 06:08 AM
Hi Alcides,
@Flonares wrote:
But the shift register needs to be initialized, correct? So how would I properly initialize it?
You could use the data from DAQmx when the sift register holds an empty array (aka: use the data of the first iteration)…
04-22-2024 07:28 AM
It is prolly asking for too much, but would you be so kind as to provide me with a minimal working example of your idea? I still have some issues trying to understand how I would implement it.
Kind regards,
Flo
04-22-2024 07:41 AM - edited 04-22-2024 07:41 AM