LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

output for loop iteration

Solved!
Go to solution

Hi folks!

 

I am trying to use a very simple "For Loop" with "16" iterations, and Shift Registers beggining in "0" and adding "4" each iteration.

 

But I am not successfull in outputing each iteration value! Only the final value of "64"!!

 

Is it possible to output each iteration value in every loop?

 

If it is, then could you provide an example?

 

 

Cheers! 

0 Kudos
Message 1 of 28
(9,030 Views)

Not sure exactly what you're trying to do here.  You won't receive an output from the FOR loop until it's finished executing...after iteration #16.  The output of your shift register will, of course, be your final value, as you are seeing.

 

If you want all of the values, you are going to have to use the FOR loop to create an array as your output.  Your first iteration will be contained in element 0, the next one in element 1, etc.

 

See attached picture.

d

0 Kudos
Message 2 of 28
(9,022 Views)

I wanted to output the individual value of each iteration, if possible.

 

If not, then i guess I could use an array.

 

However, can use "reshape array" to send each array element at a time.

 

For instance, send "0" first, then "4", then "8," etc...?

 

Cheers. 

 

0 Kudos
Message 3 of 28
(9,017 Views)
What is you r goal here? It might helps us help you if we know what you are trying to do here.
Tim
GHSP
0 Kudos
Message 4 of 28
(9,014 Views)

Well, as I said, you're not going to get anything out of the FOR loop until it's finished executing.  So no, you can't output a value of 0 on your first iteration, do something with it, output a value of 4 on your second iteration, do something with it, etc...unless you put your processing code inside the loop.  Does that make sense?

 

And what do you mean by "send"?

 

If you could post your code or be clearer about exactly what it is you want to do (the whole picture, not just the loop), we could be more helpful.

 

d

0 Kudos
Message 5 of 28
(9,008 Views)
To "output" the results of a loop as they happen per iteration, you need a parallel loop with a local variable or queue or notifier to read/display the data.
Message Edited by Broken Arrow on 11-04-2009 01:08 PM
Richard






0 Kudos
Message 6 of 28
(9,004 Views)

I am trying to create a For Loop that sends a value to a "Rotate Array".

 

But I need to rotate it more than once. The first value is zero, the second "4", the third is "8" and so on...

 

The array that I an trying to rotate is composed by the Address Bits of 16 multiplexers.

 

The final purpose is to change dynamically the Address Bits of 16 multiplexers.

 

I have tried to place my code inside the loop (a logical assumption) but I get an error 200010...

 

I have attached the vi.

 

Hope it helps.

 

Cheers. 

Message Edited by Rsilva on 11-04-2009 01:07 PM
Message Edited by Rsilva on 11-04-2009 01:08 PM
0 Kudos
Message 7 of 28
(9,003 Views)

I'm sorry...I'm still not clear on exactly what you're trying to do.  You want to use a FOR loop to create an array containing the values 0,4,8...etc.  You want to take that array and do something with it (rotate it).  You want to rotate the array as you are creating it, and "send" it somewhere.  Are you "sending" the entire 16-element array at the same time, or are you "sending" a single element at a time?

 

If you want to rotate the array as you are creating it, and then "send" it when you're done, put your "rotate array" function inside your FOR loop and perform your operation there.  The output of your FOR loop will be your rotated array.  Alternatively, as was suggested, you can use parallel loops and a queue or notifier to accomplish the same task.

 

If you want to "send" a single element at a time, then use parallel loops and a notifier.  Your other loop will contain whatever code you're using to rotate the array and "send" your element.

 

Apologies if I have misunderstood what you are trying to do.

0 Kudos
Message 8 of 28
(8,989 Views)

I have attached the vi.

 

Perhaps it's easier to understand.

 

Also , I am very new to LabVIEW and am not familiar with using "queues".

 

I apologyze for the confusion.

 

RSilva

 

Cheers. 

0 Kudos
Message 9 of 28
(8,979 Views)

Is it related to this thread of yours?

 

What are you trying to do now that is different then the message you marked as the solution in that thread?

0 Kudos
Message 10 of 28
(8,975 Views)