LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Improving this loop

I met (exceeded) the target.

The troffee goes to Tomi!! 

96% improvement!!! 

Thanks!!

😄

0 Kudos
Message 11 of 30
(1,128 Views)

Hi gbecker,

Sorry I didn't try out your solution.  I need to deliver the working program in a few minutes.  I hope to find time later to try it.

Thank to everyone!!

RayR

0 Kudos
Message 12 of 30
(1,125 Views)
Thanks for the toffee. Was your speed improvement only 2x as fast as your original code? Weird, I really thought it would speed up by several orders of magnitude.

Tomi

Message Edited by Tomi M on 02-14-2007 08:10 PM

--
Tomi Maila
Message 13 of 30
(1,113 Views)

LOL!! 😄

No.. the speed improvement was 6 times for the overall sub-vi.  I would say at least 10 times for just that loop!

Thanks!

RayR

0 Kudos
Message 14 of 30
(1,105 Views)

No.. the speed improvement was 6 times for the overall sub-vi.  I would say at least 10 times for just that loop!


Well, that sounds more realistic Smiley Wink

Tomi
--
Tomi Maila
Message 15 of 30
(1,100 Views)
Hi all,

i just checked on gbecker's solution and i must confess that it is the best one IF the arrays may look a bit different after the rework 🙂
Both arrays have the blanks removed (ASCII 32) and the numeric array has '0' and '1' instead of '48' and '49'. And all 'x' have been replaced with '0', not only the uppercase-ones. The boolean array has only TRUE for '1's in the numeric array, so all 'x' (which are '0' now) do not have the TRUE in the boolean array.
Since performance is far better (i would say about 100 or more times) this should get the award EXCEPT the arrays have to include the blanks and 'x' mustn't be replaced with '0'.......

Norbert
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 16 of 30
(1,073 Views)

Thanks Norbert.

I have to check this out as well..  It's always good to learn! 🙂

We have to give out 2 troffees

😄

 

Message 17 of 30
(1,047 Views)

I tried Norbert's approach.  Extremely fast!!

Almost the solution with one caveat...  I need to preserve the "X" and create a String Array (don't ask!!! 😠

However, I do want to get rid of the of the String Array as I don't see any benefits from it.. other than creating an array of "Don't cares".. 

The "X" get converted to a value of zero (0).  Even if I wire a %s to format the Spreadsheet string to array.

Thanks!

RayR

Message Edited by JoeLabView on 02-15-2007 01:06 PM

0 Kudos
Message 18 of 30
(1,034 Views)
Perhaps an initial stage to replace all 'X' chars with an illegal numeric character like '2'?  Then gbecker's inline approach will preserve all the "don't cares" as the numeric value 2, which you could reconvert back to ASCII 'X' if/when needed.
 
There's a string primitive named something like 'Match/Replace Pattern' that would let you specify the regular expression "[xX]" to preserve case-insensitivity.  I'm not 100% sure that's the fastest way to search and replace, but it *is* pretty darn fast.
 
-Kevin P.
CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW?

(Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).



Message 19 of 30
(1,020 Views)
Hi Kevin,
 
Thanks for the suggestion.  Of course!!  Why didn't I think of that???? 😮
My brain is definitely on vacation!!!  😉
 
Yes.. that will definitely work.  I may get a chance to re-visit that code next week (??).  If so, it will get improved.
 
Thanks!
 
RayR
0 Kudos
Message 20 of 30
(1,006 Views)