LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

delete empty strings from array

Solved!
Go to solution

hi,

maybe its simple and easy but I dont understand. I try delete empty strings from array but I fail.

 

For example:

[index]string

 

[0]tom

[1]adam

[2]eve

[3]

[4]

[5]

[6]peter

[7]jane

[8]

 

result

[0]tom

[1]adam

[2]eve

[3]peter

[4]jane

 

thanks

Norbert

0 Kudos
Message 1 of 20
(20,173 Views)

I find solution 🙂

 

0 Kudos
Message 2 of 20
(20,160 Views)

A couple of options attached.

The first is pretty simple and autoindexes an array in a for loop. Might not be too efficient for big arrays.

The 2nd uses the OpenG filter 1D array - search for OpenG if you haven't encountered it... its a toolkit of functions which can be used in your code subject to some fairly mild conditions.

 

Also, consider voting for Jim Kring's idea which would make this even easier.

Message 3 of 20
(20,154 Views)

thanks _lan_ for your help but I find solution

0 Kudos
Message 4 of 20
(20,147 Views)

@timing wrote:

I find solution 🙂

 


Your code will work...it is similar to the OpenG option. BUT...

There is no need for the local variables!

Look at using shift registers instead of carelessly dropping local variable everywhere... it'll save you trouble later on!

0 Kudos
Message 5 of 20
(20,146 Views)

oh yes its works Smiley Happy with shift registers...I dont understand too shift register and I try use local variables.

Hmm

_lan_ what is different for your code and my code? I thing shift register and local variable because you write trouble later on.

 

Thanks

0 Kudos
Message 6 of 20
(20,139 Views)

@_Ian_ wrote:

@timing wrote:

I find solution 🙂

 


Your code will work...it is similar to the OpenG option. BUT...

There is no need for the local variables!

Look at using shift registers instead of carelessly dropping local variable everywhere... it'll save you trouble later on!


Even worse... there's no guarantee that the terminal is written before the local variable is read... that could lead to unexpected results. So the code doesn't necessarily work.

Message 7 of 20
(20,138 Views)

dan_u

hmmm and your solution or any idea to correct code for delete empty strings from array?

thanks

0 Kudos
Message 8 of 20
(20,130 Views)

As Ian wrote... just replace your local variables with a shift register. Wire the array to the outside of the shift register and modify it in the loop.

0 Kudos
Message 9 of 20
(20,126 Views)
Solution
Accepted by topic author Norbertiku

To get rid of the local variables is easy.

That gives you three options.... which one would you choose? I know which I'd go for.

Spoiler
and it isn't either of the top two!

 

 

filter array_BD.png

 

 

For more info on the  OpenG toolkit - where to get it, how to install it etc, see here.

Message 10 of 20
(20,123 Views)