Example Programs

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Array Manipulation Using Conditional Loop Tunnels

Overview
LabVIEW now features an option to conditionally send data out of a loop tunnel. Auto indexing an array each side of a for loop will allow you to perform custom array operations such as only taking out odd or even data


Description
This example uses the "Quotient & Remainder" function to make sure that only even or odd numbers are added to the output array. Instead of this function you could use any of the control structures, logic or math functions in LabVIEW to build a specific array function. The one I've built quite simply allows for all of the data, none of the data, or odd and even sets of the data to be extracted.


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Choose the data to extrate
  2. Run VI

 

Additional Information or References
VI Block Diagram

 Block Diagram.png

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Daniel Harryman MEng
CLA, CPI
Comments
Member mtedaldi
Member

Awesome. I did not know about this Function! This alone makes it almost worth to switch to LV 2012!

--
Marco Tedaldi, University of Zurich, CLAD
Member DanHarryman
Member

You can do this in older versions of LabVIEW as well just with case structures inside the Loop. I'll upload an image of the old functionality.

Daniel Harryman MEng
CLA, CPI
Member mtedaldi
Member

Thank you for adding a solution for older versions. In my experience this solution comes with a big performance penalty compared to the auto-index solution.

I'll try to run some benchmarks to test it.

--
Marco Tedaldi, University of Zurich, CLAD
Member DanHarryman
Member

No problem, I think you might be right about the performance of the older version. If you do benchmark it please post your findings on here.

Daniel Harryman MEng
CLA, CPI
Member mtedaldi
Member

Ok, I've made a test VI and wrote a little document Benchmark "build array" vs. "auto indexing" in a loop (since it seems I can't add uploaded files to comments).

Conclusion: There is a huge speed penalty on "build array" against "auto index".

--
Marco Tedaldi, University of Zurich, CLAD
Member FabriciusLopes
Member

I don't notice this function until now ! This makes my life a lot easier. Thanks a lot.