LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array Q

Hi now i am having one input array which contains eight elements with inbetween space in the array.Now i want to fill the empty space with next element and i also want the final array size to be equal as input by replacing empty in it.
0 Kudos
Message 1 of 12
(4,208 Views)

Like this? Smiley Wink

Hope it helps..

0 Kudos
Message 2 of 12
(4,201 Views)
Hi LabVIEW5,
try this.
Mike
0 Kudos
Message 3 of 12
(4,198 Views)

Hi Mike.. I definitely need more experience..

🙂

0 Kudos
Message 4 of 12
(4,191 Views)

LabVIEW5 wrote:
 i also want the final array size to be equal as input by replacing empty in it.


Here is another method which allows you to simply fill in whatever you want to replace the empty elements.  It uses no loop and may be faster for much bigger arrays.
 
If you simply want to preserve the blank string elements and put them at the bottom, you can easily modify the code.

 


Message Edited by JoeLabView on 02-22-2008 08:54 AM
0 Kudos
Message 5 of 12
(4,180 Views)

If the solution provided by Mike is what you were looking for, here is a simplified version:



Message Edited by JoeLabView on 02-22-2008 09:01 AM
Download All
0 Kudos
Message 6 of 12
(4,174 Views)

Hi JoeLabView,

thats a good solution, but what if the input is like this (see the picture)? With your solution you have an other order as consciously.

Mike

0 Kudos
Message 7 of 12
(4,171 Views)

Do you mean not sorting the array?

 

0 Kudos
Message 8 of 12
(4,164 Views)

Hi JoeLabView,

yes thats what i mean, because he only want to move the empty fields to the end of the array.

Mike

0 Kudos
Message 9 of 12
(4,159 Views)
That sounded almost like a challenge 😄 LOL!!
 
Okay here goes.  This version will require the number of iterations based on the numbver of items to move to the bottom.  So, using your example, it will do it in 3+1 = 4 iterations.
Can't get away from using a loop.  Maybe if Altenbach sees this thread, he may have some other improvements LOL!! 😄  Well, it can be improve a tiny bit to exclude that last iteration..  we won't get into that.. 😉
 
For huge arrays and if speed is essential, you can try this one.  😉
 
RayR
 
 
 




Message Edited by JoeLabView on 02-22-2008 11:51 AM
Download All
0 Kudos
Message 10 of 12
(4,141 Views)