03-18-2013 02:52 PM
Hi everyone,
I'm writing some code in which I instantiate many objects when I first start my code and place the objects into an array that is used as a lookup table later on in operation. This takes up a lot of space on the block diagram and makes it difficult to understand for the user that is not familiar with the code. Is it possible to create something like a flat sequence that can have a single indexed output tunnel? I want something like what you would get when having a tunnel out of a for loop I just want each itteration to be unique (unlike the for loop). I've included an image of what my diagram currently looks like for reference. You can see that I create all of the objects with unique information (ID, control reference, etc.) and then build an array with them. I would like to instantiate each of these objects in a frame of a stacked sequence with a single indexed output (if possible).
Thanks for the advice!
-Eric
Solved! Go to Solution.
03-18-2013 03:01 PM
You could make that whole thing there a sub-vi. That way it is nice and clean at a higher level, but if you needed to look at the nuts and bolts, nothing is hidden...
03-18-2013 03:10 PM
Option 1: use a subVI
Option 2: Use a FOR loop as a sequencer. Instead of the stacked (or flat) sequence structure, put a case structure inside of a FOR loop and wire the i to the case selector. Then in each case you can initialize a different class. The output can then be autoindexed.
03-18-2013 03:14 PM
I had considered a sub vi but if you notice i have control references as inputs and so I would still end up having to create a cluster of references as an input to the sub vi. I really like the idea of the for loop and the case structure. I don't know if its really proper to do that but it will definitely clean up my code a lot. Thanks.
-Eric
03-18-2013 03:16 PM
@etridas wrote:
I had considered a sub vi but if you notice i have control references as inputs and so I would still end up having to create a cluster of references as an input to the sub vi. I really like the idea of the for loop and the case structure. I don't know if its really proper to do that but it will definitely clean up my code a lot. Thanks.
-Eric
I actually like option 2 better, also. That's why cross has all those logos. 😉