LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Align and Resample When One Waveform Has a Length of 1

I am attempting to align and resample waveforms from two sets of data recorded in a loop. In each loop iteration, the following sets of data are taken:

  • The first set of data has length 50 and dt 0.001 sec
  • The second set of data has length 1, resulting in a dt of 0

I would like to align and resample the second set of data using the Coerce method so that the single value is propagated across the timestamps of the first waveform. However, when I attempt this with the Align and Resample Express VI, I get the error shown below. Does this indicate that this operation is beyond the capability of the express VI, or do I have the settings incorrect for what I want to do (also screenshotted below).

ndaniel9_0-1739228800509.png

ndaniel9_1-1739228861814.png

 

 

0 Kudos
Message 1 of 7
(190 Views)
Can you show an example of what you want to do? Hand-drawn or MS Paint is fine.
0 Kudos
Message 2 of 7
(183 Views)

The Align and Resample Express VI is unable to do this.  You'll need to do it manually.

 

I'm guessing you are using the "Dynamic data" type, which is mostly for beginners or people trying to create code for experiments really quickly.  It's not recommended for use when you try to do anything funny.

 

I don't use Dynamic Data enough to know if there's an Express VI built directly for this, but what you could do instead is this, assuming I am interpreting your desire correctly:

Kyle97330_0-1739232775984.png

I've labelled all the nodes in use so you can search for them as needed.

 

Basically:

Convert both "Dynamic Data" into a single "waveform" data.

Get the components of those waveforms

Create a new array of data equal to the length of the long waveform but with each data point equal to the data from the short one's first (and only) element

Build a new waveform matching the start time and delta time of the long waveform but with the data set to that of the newly created array.

Convert back to dynamic data.

 

Note:

This is meant to be just something to get you over your immediate need.  Long term, I strongly recommend learning and using LabVIEW without any "Dynamic Data" wires at all.

0 Kudos
Message 3 of 7
(180 Views)

@ndaniel9 wrote:

 

  • The first set of data has length 50 and dt 0.001 sec
  • The second set of data has length 1, resulting in a dt of 0

 

The dt is independent of the number of data points. it is even fully defined for a waveform with no points. If there is only one point, a resampled array will have that same value just more or less times.

0 Kudos
Message 4 of 7
(166 Views)

I am not using the dynamic data type, the issue is that I manually assigned the waveform to have a dt of 0 and forgot about it. Once I fixed that, however, I was still not getting the expected behavior.

However, the block set you built looks very promising, I did not realize that the array initializer worked that way. One thing that might complicate it is that both data sets are arrays of waveforms, so I may need to play with the dimensions a little more to get it to work.

0 Kudos
Message 5 of 7
(115 Views)

We can typically offer much more specific help once you attach a simplified VI and some typical data.

 

I assume that you want to get the various waveform to a common t0,dt and all you probably need is a new t ramp followed by resampling. For each waveform, you can just take the Y array and use "interpolate array" by calculating the fractional index base on t0,dt. You don't need express VIs or dynamic data for any of this. 

 

0 Kudos
Message 6 of 7
(104 Views)

@altenbach wrote:

For each waveform, you can just take the Y array and use "interpolate array" by calculating the fractional index base on t0,dt. You don't need express VIs or dynamic data for any of this. 

 


Here is a very (very!) rough draft. (Probably needs a few tweaks, nothing a +1 or -1 in the right place cannot fix. 😄 )

 

altenbach_0-1739303678324.png

 

0 Kudos
Message 7 of 7
(99 Views)