LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

take a string of A's and B's and keep track of which place in the string that A or B occurs

Solved!
Go to solution

I would like to create a VI that would take a strings of A's and B's such as "AABBBAAA"

and would create two list (or arrays) of tracking when A occours and the other tracking when B occurs.

For this example, A should be {0,1,5,6,7} and B should be {2,3,4}.

 

I have created a vi so far that is not working as I wanted.  Instead of having a 5 element array for Index A and 3 element array for Index B.  I got an & element array for both.  However, whenever there is no A in Index A the value is placed as zero so it would be {0,1,0,0,0,5,6,7} and Index B end up to be {0,0,2,3,4,0,0,0}.  Can anyone help me out?  

0 Kudos
Message 1 of 9
(3,109 Views)
Solution
Accepted by topic author ttk12acd

Did you need this?

 

graziano

Message 2 of 9
(3,104 Views)

have a look, if it is the function, you will have..

0 Kudos
Message 3 of 9
(3,101 Views)

hi jhoormann, 

 

I only have labview 8.2 so I couldn't run the vi that you send me. Is it possible you to send a picture of the vi or just tell me the name of the function that you have used in your vi?  Thanks 

0 Kudos
Message 4 of 9
(3,059 Views)

Hi graziano,

 

I have a couple question regarding the vi.  I hope you can explain to me if you have the time.  What does the down arrow and up arrow mean on the side of the for loop frame?  Also why is there an empty numeric array needed?  Is it so that they would place it in the array intead of resorting to placing the default 0 like in my ealier vi?   

0 Kudos
Message 5 of 9
(3,055 Views)

ttk12acd wrote:

 

What does the down arrow and up arrow mean on the side of the for loop frame?  Also why is there an empty numeric array needed?  Is it so that they would place it in the array intead of resorting to placing the default 0 like in my ealier vi?   


Hi!

   I didn't look at you VI, sorry... mainly because in my working PC I have LV 7.1.  

 

   Let me be direct: those arrows are "Shift registers", and are a basic LabView concept.  If you aren't familiar with this, maybe you should take little time to read at least LabView User Manual.  They are used extensively in LV programs, and for some scopes are a really good programming technique (consider ActionEngines or simple dataflow in loops).

 

   The empty array is not strictly needed, I put it only to readability of code.

 

   When I'll be able to do it, I'll open your VI and comment a little on it.  Thanks for your feedback, have a nice day!

 

graziano

0 Kudos
Message 7 of 9
(3,028 Views)

Hi!

   I think you need to understand indexing of arrays in loops: look at those small sqares with bracket, they means that you're indexing output lines of for loop.  At each loop iteration, you add an element to the output wires, to form an array which contains the same numbers of elements as the number of loop cycles.  Check also for this on the manual, since it is an important feature. 

 

 

 

   have a nice day!

 

graziano

Message Edited by Graziano on 10-28-2008 02:58 AM
0 Kudos
Message 8 of 9
(3,023 Views)

....I forgave: Why "Index A" and "Index B" indicators are set as DBL (double precision)? They should be something like U32, or U16, do you agree?

 

graziano

0 Kudos
Message 9 of 9
(3,020 Views)