LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search and Replace elements in an array

Hello, I am new to LabView and was to create some basic VI's . I was able to make a search and replace Program but now I want a counter to indicate how many elements were found and replaced. How do I do that? 

Thank You

0 Kudos
Message 1 of 6
(2,721 Views)

You need while loop and shift registers.
In your code for loop works as many times as array length, but you need stop if already no elements.
Also your program never replaces first element

array.png

0 Kudos
Message 2 of 6
(2,700 Views)

Search_Replace.png

 

Not Maintained Search Order anyways it will Once replaced with new number it wont alter the array values, so search can be started from zero it wont create difference.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 3 of 6
(2,691 Views)

@PalanivelThiruvenkadam wrote:

Search_Replace.png

 

Not Maintained Search Order anyways it will Once replaced with new number it wont alter the array values, so search can be started from zero it wont create difference.


Those controls should be outside the loop.

 

And of course passing the start index in a shift register will make a difference! Starting over form 0 will cost CPU cycles, which is not necessary. This will make more difference as those arrays grow in size.

0 Kudos
Message 4 of 6
(2,684 Views)

And of course passing the start index in a shift register will make a difference! Starting over form 0 will cost CPU cycles, which is not necessary. This will make more difference as those arrays grow in size.

 

Exactly! this why I use second shift-register

Message 5 of 6
(2,678 Views)


Those controls should be outside the loop.

 

And of course passing the start index in a shift register will make a difference! Starting over form 0 will cost CPU cycles, which is not necessary. This will make more difference as those arrays grow in size.


Thanks Points Taken, Suggested points are taken into consideration.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 6 of 6
(2,671 Views)