Error Connecting Terminals of Different Types Through For or While Loops

Updated Nov 6, 2023

Reported In

Software

  • LabVIEW

Issue Details

  • I wired an error wire through a loop and it gave an error for connecting two terminals of different types. The  error says that the type of the source is a 1D array of cluster of 3 elements. The type of the sink is cluster of 3 elements.
  • I am using a loop and my data is being collected correctly inside of the loop, but when I try to process or log the data after the loop, I receive a type mismatch error similar to the one above. Why is my data being rejected?

Solution

The tunnel on the loop should be changed to Last Value instead of Indexing. Accomplish this by right-clicking the tunnel on the edge of the loop and selecting Tunnel Mode>>Last Value.

Additional Information

  • The auto-indexing tunnel mode builds an array of the values from all iterations of the loop. This will cause an error when the sinking terminal expects values that are not arrays.
  • Auto-indexing tunnels can be helpful as a replacement for collecting data in a shift register and adding new data to that shift register during each loop iteration. However, be careful that your code does not include both a shift register-based and auto-indexing-based implementation for collecting multiple iterations of data. It is likely that only one is needed.
  • In similar cases, this issue can sometimes be quickly resolved by concatenating all members of the array into a single data structure. This can be helpful when working with waveforms that should contain merged data in a single waveform, rather than an array of waveforms.