adavid Posted March 13, 2004 Report Share Posted March 13, 2004 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 Quote Link to comment
regisphilbin Posted March 14, 2004 Report Share Posted March 14, 2004 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? Quote Link to comment
Michael Aivaliotis Posted March 14, 2004 Report Share Posted March 14, 2004 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. Quote Link to comment
regisphilbin Posted March 14, 2004 Report Share Posted March 14, 2004 Thanks mike...I learn something new every day! regis Quote Link to comment
adavid Posted March 14, 2004 Author Report Share Posted March 14, 2004 Hi, its me replying to myself. I wanted you all to know that I figured out a way to do this using 'Index Array'. I end the loop on when one of the cluster array string fields is NULL. Seems like a lengthy and wierd way to accomplish this looping but is in fact working. If anyone knows of an easier more direct way, please let me know. Download File:post-10-1079307478.doc Quote Link to comment
adavid Posted March 14, 2004 Author Report Share Posted March 14, 2004 Thanks you guys!! Afer I replied to myself, I realized you guys had gave me some suggestions to try. I will give this a shot and let you know. Thanks again!! Quote Link to comment
adavid Posted March 16, 2004 Author Report Share Posted March 16, 2004 Yes, your suggestion works perfect! I am using it!!! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.