I'm not sure I understand your problem. A for loop will automatically create an array and you don't have to preallocate anything. This is assuming you're using the autoindex feature of a for loop. That's the fastest and most effecient way to create an array. If you're not doing this, could you explain exactly how you're creating the array?
Use Build Array.vi and shift register(s) to dynamically create the array. See the attached.
For memory management, it is better to initialize the array and replace elements. If it's nested for loops, why don't you know the number of iterations?
You don't have to create an array before, just add new elements to a blank array f size 0. Basically get size of array (which will start from 0) and use that value for index in InsertArray function.
vishi
"gwong" wrote in message news:5065000000080000003B920000-1042324653000@exchange.ni.com... > I am creating an array of elements from a nested for-loop... thus > there is no determined size. How can accomplish this?
My for-loop will have multiple outputs and thus the array is of unknown size. I am attaching what I have so far and the problem lies in the building array. My program is supposed to be generating a square spiral shape on an XY graph. (The N-value for the outer most for-loop is just for testing purposes and will be changed.)
Maybe you could explain exactly what you're trying to generate. The VI is hard for me to understand because you've wires going underneath objects and looping back and I would think your problem would be simpler to implement without all of the shift registers and just let the for loops generate arrays like they're intended.
I think the easiest way is to attached the C code that I wrote and am trying to put into Labview. The problems I am running into are the variable k and also the setting of each array. Thanks for your help so far and any further help would be greatly appreciated!
"gwong" wrote in message news:50650000000500000041040100-1042324653000@exchange.ni.com... > I think the easiest way is to attached the C code that I wrote and am > trying to put into Labview. The problems I am running into are the > variable k and also the setting of each array. Thanks for your help > so far and any further help would be greatly appreciated!
What Dennis said is the easiest and best way to do that. To add C code to a labview program for functionality already present in Labview makes no sense, it adds unnecessary complexity and makes debugging much more difficult.