LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search and replace string problems

Hi to all,

I have problem with Search and replace string function. It shows me a wrong Value (Number) from 15 to 100 is everything OK (15=0, 30=1, 45=2, 100=3), but after 100 ........

Take look in VI and if you have any ideas post them please 🙂

 

THX

Igor 

0 Kudos
Message 1 of 7
(3,756 Views)
What is it that you're trying to do? What is your input string, and what are you expecting to get out? It appears that you are trying to do a substitution. If that's the case, one problem you have is that you need a shift register. Otherwise your output will simply be the same as if you have done only the very last substitution, and none of the ones before it. Also, you can replace the while loop with a for-loop. Also, if doing a substitution, are you intending to substitute all instances? If so, then you need to start with the longest string to search for first.
0 Kudos
Message 2 of 7
(3,731 Views)

it`s like this: if the string same as one of the Numbers in column 1 the Value (Numeric) should be the same as the the Numer in column 2 (same row)..

0 Kudos
Message 3 of 7
(3,721 Views)
Well, I pretty much figured that out from the code. But you still have not provided the string that you're actually feeding the VI, and what you expect the VI to provide. Also, my other query: is it supposed to replace all instances? For example, let's say the input string is "15115". Should the output be 10 or 4?
0 Kudos
Message 4 of 7
(3,703 Views)
there will be no 15115 string, but 15 or 115 and 15 is 0, 115 is 4. Anyway, i have changed string input format and now its working 😉 THX for your help
0 Kudos
Message 5 of 7
(3,685 Views)

I cant open your file as i've only got 8.2, but from your explanation i'd solve it like this:

 

String --> String to number --> (modula) Divide by 15 = index

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 7
(3,679 Views)

Based on your latest VI it appears that you want to convert an hour:minute string to an index. It really would have helped if you had said this from the beginning, as there is a far easier way to do this:

 

 

0 Kudos
Message 7 of 7
(3,660 Views)