LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove blank spaces when searching array with for loop?

I am trying to search a 2D array and create a new array with the matched rows. I am getting blank spaces when the search is false how to i get the program to skip instead of putting blank spaces here the case structure disconnects the path out when false.

 

Thank you for your time

Screenshot 2023-06-21 112152.png

0 Kudos
Message 1 of 8
(1,098 Views)

I figured it out right after posting, had to change the tunnel out of the for loop to conditional.

0 Kudos
Message 2 of 8
(1,096 Views)

... of course that initialize array and insert into array makes no sense. these don't do anything useful

 

Here's probably all you need...

 

altenbach_0-1687371258197.png

 

0 Kudos
Message 3 of 8
(1,060 Views)

@altenbach wrote:

... of course that initialize array and insert into array makes no sense. these don't do anything useful


For that matter, it doesn't even look like the Case Structure is required (assuming nothing is in the FALSE case).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 8
(1,054 Views)

Thanks that will make it much easier. Learning some new tricks with my latest program. Have only used shift registers up until now. This time I used the case structure and now my entire program fits on one screen without having to scroll around. This also makes my CPU usage almost 0 when nothing is happening where before it would be  a steady 15% ± 5 running the loop.

0 Kudos
Message 5 of 8
(1,049 Views)

@altenbach wrote:

... of course that initialize array and insert into array makes no sense. these don't do anything useful

 

Here's probably all you need...

 

altenbach_0-1687371258197.png

 


@CA Hmmm... did postage stamps get bigger?

 

You could migrate the indexing and comparison outside the loop by choosing the compare elements option from the right-click menu of the Is Equal primitive and have no code inside the loop! 😉  Just two auto indexing tunnels in and a conditional tunnel out.


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 8
(1,025 Views)

@JÞB wrote:
You could migrate the indexing and comparison outside the loop by choosing the compare elements option from the right-click menu of the Is Equal primitive and have no code inside the loop! 😉  Just two auto indexing tunnels in and a conditional tunnel out.

Yes, but that would need to allocate two extra intermediary arrays ((1)the second column and (2) the Boolean array), so if the inputs are truly gigantic, we might run out of memory. 😄

Message 7 of 8
(1,019 Views)

@altenbach wrote:

@JÞB wrote:
You could migrate the indexing and comparison outside the loop by choosing the compare elements option from the right-click menu of the Is Equal primitive and have no code inside the loop! 😉  Just two auto indexing tunnels in and a conditional tunnel out.

Yes, but that would need to allocate two extra intermediary arrays ((1)the second column and (2) the Boolean array), so if the inputs are truly gigantic, we might run out of memory. 😄


Thinking about it, that codeless loop would make a powerful VIM!  I don't really have the time to fully test a full scale vim with the type specific cases in the optimal order.  Could you bring that discussion up on another board? (I'm still Emeritus and can't get there)


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 8
(976 Views)