LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

empty line

Sorts in 1.9 seconds on my PC.  Let me know if this works for you.

 

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
0 Kudos
Message 11 of 16
(1,290 Views)

you are right.... i had another program running in the backround.

Thanks

0 Kudos
Message 12 of 16
(1,285 Views)
Ignore


Message Edited by Matthew Kelton on 12-26-2007 02:08 PM
0 Kudos
Message 13 of 16
(1,282 Views)

OK, 1900ms is an eternity!!!! With a few optimizations, it can be done in way under 100ms!

Here are the problems in Matthews VI.

  1. Building a huge array row-by-row in a shift register is  an incredible waste of resources, because with every resizing of the array, a new copy needs to be made in memory.
  2. the number of iterations is known before the loop starts, thus we need a FOR loop and not a while loop.

Here's a tweaked solutions that does things in about 60ms on my computer (30x faster!!!).

  1. The allocation of the original array is reused for the output array.
  2. We keep track on an "insert point" in a shift register that is incremented whenever we need to keep a row.
  3. Each row is checked, and if not empty, moved to the row index at the "insert point"
  4. At the very end, we trim the array to the final size in one operation.
  5. If you look at the buffer allocations, everything is done "in place", the most efficient way to do things.

See attached VI, LV 8.5.



Message Edited by altenbach on 12-26-2007 12:54 PM
Download All
0 Kudos
Message 14 of 16
(1,272 Views)
Thanks for pointing that out.
Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
0 Kudos
Message 15 of 16
(1,269 Views)


Alvarion_Israel wrote:
i have tried doing as you can see in the attached  vi but its takeing alot of time and if i will try to use the "empty array?" comp he will not see the empty strings as empty array.
can it be done better?

Just a few comments on your original code. It contains quite a few problems.
  1. The "x+1" should be an integer (blue) and not orange.
  2. If you would use a shift register instead of a local variable for "x+1" you would not need an indicator or any of the local variables, just a plain wire.
  3. Once you use a shift register for "x+1", the inner sequence is obsolete.
  4. The outer sequence serves no purpose
  5. Your "output array 4" local variable use acts similar to an uninitialize shift register. This means that the output array grows whenever you run the VI.
  6. You would need to make sure to empty it before each run.
  7. Eliminate the "output array 4" local variable and use an initialize shift register instead.
0 Kudos
Message 16 of 16
(1,263 Views)