Jump to content

1D array search implementation


kodon1

Recommended Posts

Posted

Hi,

 

I need to implement some sort of a 'search 1D array' function, but only with simple functions.

This means that I can use loops and cases and other simple functions (numeric. boolean, comparison) but not much more than that.

 

The challenge that I'm facing is to create a smaller array out of a bigger one. I wasn't able to find a way up until now.

 

Hope that you'd have some ideas.

 

thanks

Posted

Use a FOR loop with a coniditional terminal.  Autoindex in the search array.  If the current item matches the search parameter, you stop your loop and pass out the data.

Posted

thanks.

so I stop the for loop when the first value is found, but then I want to keep searching the array... should I use some sort of an outer loop?

Posted

That is different requirements from the Search 1D Array.  If you want the all of the indecies that match, then still use the FOR loop, but use a conditional indexing output tunnel that is wired to the i terminal.  Your condition should be if the current item matches the lookup item.

Posted

ok. thanks for the tip. 

 

when you say - 'conditional indexing output tunnel' is it a straight forward option of the for loop? I wasn't aware of that

Posted

Make an wire up the i to the right border of your FOR loop.  It should default to an indexing tunnel.  You can right click on that tunnel and select "conditional".  I think it came out in LabVIEW 2012.  Very useful tool.

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.