LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Floating Nested Loop?


@cheyne wrote:
Hi,

If the 2 loops running independently, then it means 1 loop will complete before another loop starts. But I am looking for 2 loop nested together where 2 are running at the same time.


No. If the loops are running independently then they will run simultaneously. If they're nested, then the outer loop will only iterate once the inner loop has run though. I think you have a problem with terms.




Message Edited by smercurio_fc on 06-09-2008 12:45 PM
0 Kudos
Message 21 of 26
(1,065 Views)

In the example I provided, the loops are in a Case Structure, therefore only 1 will run at a time.  The loops are selected by the order that is set in a control.

I didn't understand that they might have to run simultaneously..  (they don't, do they? 😮 )

I didn't put anything in the actual loops (For Loop), which is where you place your own code. 

The number of iterations and order of loop selection will need to be from your own code also.  What I provided was just for the example.

 

There seems to be a lot of confusion about what you really need.  If none of us hit the target, can you provide more details description of what you are trying to do?

Thanks,

RayR

0 Kudos
Message 22 of 26
(1,054 Views)
Hi,

Sorry for all the confusion,

"The loops are running independently then they will run simultaneously. If they're nested, then the outer loop will only iterate once the inner loop has run though."

Yes, you are right. I am looking for nested loop with the flexibility where the outer loop task and the inner loop task is interchangable.

Actually i sort of getting something in mind. Will post my program once i completed.

However, I still appreciate if someone has also figure out how to do this and we could confirm the way I do is correct.

Thanks for all the effort. Appreciate alot.


0 Kudos
Message 23 of 26
(1,032 Views)
Ok. I think i came up with a way to have nested loops that can perform different function in different levels of "nestedness." It is rather convulated, and there is probably an easier way, but this method is very flexiable. You can have any number of functions and any number of nested loops (capped by memory). It basically creates an array that if fed into ONE for loop will act like 2 or more nested loops.

Hope this helps

Here are LabVIEW versions 8.5.1 and 8.0

Download All
0 Kudos
Message 24 of 26
(1,021 Views)

Are you familiar with a State Diagram?  It would be good if you could describe what an event triggers and what needs to handle that event (ie: Loop).

It would be better to describe concurrent events than using a flowchart. 

Here is a description from Wikipedia: http://en.wikipedia.org/wiki/State_diagram

If you do a Google Search, you will see a number of diagrams.  Using this may be easier to describe your thoughts.. 😉

RayR

0 Kudos
Message 25 of 26
(1,008 Views)
And, for implementation of a state diagram, it was mentioned way back in reply #2 that a state machine is probably the simplest way to implement this.


Message Edited by smercurio_fc on 06-10-2008 08:55 AM
0 Kudos
Message 26 of 26
(995 Views)