Jump to content

Cluster Arrays


Recommended Posts

In using the 'Librarian.vi', I see that it creates a cluster array. I have been trying to create a loop that will loop for each array index of this cluster array. And extrapolate iformation from each index. I cannot for the life of me figure out how to do this.

I have tried wiring it to a 'For Loop' but it does not iterate for the total array indexes, only does 1 iteration (and there are about 50 indexes). I have tried so many things and simply don't know how to accomplish this.

I am trying to run a loop so that I can write path and filename information to a file of all the VI's (or array indexes) coming from 'file list' of the 'Librarian.vi'. Any ideas?

Download File:post-10-1079211130.doc

Link to comment

adavid,

i believe the key for making the "for loop" work is using the "array size" function to determine how many array elements (clusters in this case) are in your array. Once you do this, the for loop will know exactly how many iterations to do.

I created a VI that retrieved the "name" element of the cluster via iterating through the array and wrote the names to a file.

Does this help?

post-10-1079227565.jpg?width=400

Link to comment
i believe the key for making the "for loop" work is using the "array size" function to determine how many array elements (clusters in this case) are in your array.  Once you do this,  the for loop will know exactly how many iterations to do.

Yes, this is good. However since you already have auto-indexing enabled, adding the array size function is redundant. You will see that if you delete this function and the wire to the N terminal, you program will still work.

In general, a for loop will iterate for every element in an indexing array input OR the number wired into the N terminal, whichever is smaller. If you have an array of size 10 and wire a 5 into the N terminal, the loop will iterate only 5 times regardless of the array size. Also, if you have an empty array then the loop will not iterate at all.

post-10-1079235272.gif?width=400

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.