Using the Align and Resample Express VI

Updated Jan 2, 2024

Reported In

Software

  • LabVIEW Full

Issue Details

I have two or more waveforms with different starting times and different amounts of samples. I need the waveforms to have the same amount of samples with equal spacing or the same start time or both. Can I use the Align and Resample Express VI to do this?

Solution

Yes, the Align and Resample Express VI performs an alignment of signals by changing the start time or performs a resampling of signals by changing the time delta. Set the Acquisition Type to Single segment if you do not want the Express VI to assume any signal history or future. Set it to Continuous if the input signal is repeated on incoming contiguous blocks of data. The signal history is reset during the first call or every time you set Reset to TRUE. If the input data is not contiguous, the Express VI returns an error.

In the case of "Single Segment" type of acquisition, you also have the option to specify if it is or not an Open interval. This parameter specifies whether the exported re-sampled waveform represents a closed (false) or open (true) interval of the input waveform. If the interval is open (true), the re-sampled data will be limited to the time interval [t0 in, t1 end], where t1 end is the time-stamp of the last input sample. If the interval is closed (false), the re-sampled data will cover the interval [t0 in – dt in/2, t1 end + dt in/2]

Additional Information

  • What does Align do? When would I use it?

    When you align two or more waveforms in LabVIEW, you are forcing all the signals to have the same start time either by segmenting them or by appending zeros to the beginning of the signals that start last and to the end of the signals that end first.

    When aligning two or more waveforms, all signals need to have the same sampling interval; otherwise you will get an error stating that the waveforms have different scanning intervals.

    If the Acquisition Type is Continuous, the Alignment Interval will be Common by default. If the Acquisition Type is Single Segment, then you can choose the Alignment Interval to be either Global or Common. See the LabVIEW On-line help for more details on both types of Alignment Intervals.

    If you want to align two or more waveforms, make sure you enable this functionality in the Align and Resample Express VI Front Panel by checking the Align checkbox. The Aligned signals will be output at the Resampled Signals outputs.
     
  • What does Resampling do? When would I use it?

    When you resample a signal, you are calculating additional samples by interpolating between existing points in the signal. Resampling is commonly used when you need to represent your current signal with a smaller sampling interval than the one that it currently has. In other words, you need to generate more samples for your existing signal based on the samples you currently have.

    The Align and Resample Express VI allows you to choose between four (4) different interpolation methods to calculate these additional samples: linear, coerce, spline and FIR filter.

    If you want to Resample a waveform, make sure you enable this functionality by checking the Resample checkbox.
     
  • Now that I have configured the Align and Resample Express VI using its Front Panel, what signals can I connect to it?

    The Align and Resample Express VI is a polymorphic VI, so it will accept different data types for a given input or output terminal. For more information on polymorphic VIs, see the LabVIEW Online Help (go to the Help menu in LabVIEW, choose "VI, Function and How-To Help (Ctrl+?)", go to the Contents Tab and Navigate to "Building the Block Diagram>>Using Polymorphic VIs").

    The Align and Resample Express VI uses the functionality of the following VIs:
    • Align Waveforms (continuous).vi
    • Align Waveforms (single shot).vi
    • Resample Waveforms (single shot).vi
    • Resample Waveforms (continuous).vi
    The VIs above are also polymorphic VIs. However, if you look at the help in LabVIEW for those VIs you will notice that there are some input signals that you can use in them that you cannot use in the Express VIs.

    The valid inputs for the Align and Resample Express VI are arrays of one or several dimensions, waveforms and arrays of waveforms.

    Keep in mind that the output Resample Signals corresponds to the input Signals, and the output Resample Signals 2 corresponds to the input Signals 2.

    You will notice that depending on how you configure the Front Panel for the Express VIs, you will have more or less inputs available in the Block Diagram. For example, if you choose to Resample at a specific dt, your Express VI will have an input for dt. If you wire a value to this input, it will overwrite the value that you entered in the Front Panel. Another example is the Reset input that will only appear available in the block diagram if you choose your Acquisition Type to be continuous.