LAVA Forums Buy cool LAVA gear Forums RSS Feed

Welcome Guest ( Log In | Register )

> Related links

Check out our General Code Repository Files. Also, before posting here, check to see if your post doesn't fit into another subforum by category.


Tags
(This content has not been tagged yet)
 
Reply to this topic Start new topic
> Cluster Arrays, How do I loop on the indexes?
adavid
post Mar 13 2004, 08:52 PM
Post #1


Enough LAVA to be dangerous


Member
Posts: 4
Joined: 13-March 04
Member No.: 306
LV:6.1


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?
Attached File(s)
Attached File  LabVIEW_Question_Screenshots.doc ( 58K ) Number of downloads: 196
 


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Ad
post Mar 13 2004, 08:52 PM
Post #















Tags
(This content has not been tagged yet)
Go to the top of the page
Quote Post
regisphilbin
post Mar 14 2004, 01:26 AM
Post #2


Very Active
***

Member
Posts: 81
Joined: 27-June 03
From: San Diego, CA
Member No.: 127
LV:7.1.1
United States Nothing Selected Nothing Selected


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?
Attached thumbnail(s)
Attached Image
 

--------------------
Certified LV Associate Developer


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Michael_Aivaliot...
post Mar 14 2004, 03:34 AM
Post #3


Confucius say: Crowded elevator always smell different to midget
Group Icon
*****

Admin
Posts: 2367
Joined: 13-October 02
From: Planet Earth
Member No.: 2
Using LabVIEW Since:1994
LV:8.5 ,8.2.1 ,7.1.1
Greece Canada United States My Blog My Gallery


QUOTE (regisphilbin @ Mar 13 2004, 08:26 PM)
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.
Attached image(s)
Attached Image
 

--------------------


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
regisphilbin
post Mar 14 2004, 07:36 PM
Post #4


Very Active
***

Member
Posts: 81
Joined: 27-June 03
From: San Diego, CA
Member No.: 127
LV:7.1.1
United States Nothing Selected Nothing Selected


Thanks mike...I learn something new every day!

regis

--------------------
Certified LV Associate Developer


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
adavid
post Mar 14 2004, 11:37 PM
Post #5


Enough LAVA to be dangerous


Member
Posts: 4
Joined: 13-March 04
Member No.: 306
LV:6.1


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.
Attached File(s)
Attached File  OneResolution.doc ( 42.5K ) Number of downloads: 138
 


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
adavid
post Mar 14 2004, 11:40 PM
Post #6


Enough LAVA to be dangerous


Member
Posts: 4
Joined: 13-March 04
Member No.: 306
LV:6.1


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!!


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
adavid
post Mar 16 2004, 03:16 PM
Post #7


Enough LAVA to be dangerous


Member
Posts: 4
Joined: 13-March 04
Member No.: 306
LV:6.1


Yes, your suggestion works perfect! I am using it!!!


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

 




Time is now: 2nd December 2008 - 12:36 AM