From Friday, January 17th 11 PM CDT (January 18th 5 AM UTC) through Saturday, January 18th 11:30 AM CDT (January 18th 5:30 PM UTC), ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Equivalent for this code

Hi, Could you please let me know what is the EQUIVALENT for this code. This code replace 2 number of  0s or 1s to Just one 0 or 1. The code is very very slow when the input string is very big. Is there any way to replace it with something faster.

Thanks 

0 Kudos
Message 1 of 3
(2,398 Views)

Can you provide some numbers? How many characters are in a "very big" string? How long does it take to be "very very slow" code?

 

How many replacements typically occur in your string?

 

Do your strings ever have anything which is not a 1 or zero?

 

Lynn

0 Kudos
Message 2 of 3
(2,356 Views)

This code takes 1ms to run on a string of 60,000 characters (one continuous string of 0's and 1's).  Whereas using your code, it takes about 900ms for the same string.

Capture.PNG

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 3 of 3
(2,349 Views)