LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can i get to a specific position in a cluster? (do a Jump in a Cluster)

I have a Cluster of two strings and one Integer: String.name String.value integer.time. I want to do a search for a specific String.name and then start to work with the cluster at this position. Is this possible with simple unbundle by name search in a whileloop for the needed name and then wire the cluster to the output?. I cant and dont want to change the structure of the Cluster itself (to many dependances)! Any suggestions will be nice
0 Kudos
Message 1 of 8
(3,041 Views)
Hi Herby,
I'm assuming that what you have is an array of these clusters. In that case your idea works fine - you just have to watch out for the array size etc, so a FOR loop and a shift register works a bit better.
I've attached it anyway.

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 2 of 8
(3,041 Views)
Whoooosh that was a fast answer thanks.
but i cant open your file because Labview says error code 9 dont work with Labview 6.0
is there a chance to post it again with a 6.0 compatible code? or do a Picturedump of the diagramm? thanks for your attention
0 Kudos
Message 3 of 8
(3,041 Views)
Hi Herby - here's the file saved for version 6.0)

Hope this is right.

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 4 of 8
(3,041 Views)
Hi,

If I understand correct, you have an array with three elements.

You need the array element which maches the name.

So, use a for loop to get the name out of all array elements (use an
autoindexing for loop, and build a new auto indexed array of names).

Use search 1D array. you'll get -1 or the maching array element.

Use the index to the array, to get the entire cluster from the array.

Regards,

Wiebe.

"herbyhu" wrote in message
news:50650000000800000007560000-1027480788000@exchange.ni.com...
> I have a Cluster of two strings and one Integer: String.name
> String.value integer.time. I want to do a search for a specific
> String.name and then start to work with the cluster at this position.
> Is this possible with simple unbundle by na
me search in a whileloop
> for the needed name and then wire the cluster to the output?. I cant
> and dont want to change the structure of the Cluster itself (to many
> dependances)! Any suggestions will be nice
0 Kudos
Message 5 of 8
(3,041 Views)
Hi guys - this is actually much better in terms of memory useage than the method I employed. (About half the size because you're not dealing with shift registers which make copies of the memory locations before they're used, increasing the "front panel" memory needed.

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 6 of 8
(3,041 Views)
Herby Hu:

Not too hard to do.

You are on the right track. I would recommend taking your original
cluster array passing it into a while loop and indexing at the while
loop, and then comparing the String.name value to the test value. If
the test value=String.name, then exit the loop and assign the while
loop i index as the output that you will use to index your cluster
array.

If the loop exits without test value=String.name, then the test value
was never found and you will need to have a way to deal with this case
(assign an index of -1 and then report test value not found back to
the user or something similar. (Don't try to index the cluster array
with a -1 index though.)

You will need to use a shift register and a true false selector.
Initially assign a -1 to the shift register before beginning the while
loop. If a test value=String.name=true, then use the true false
selector to assign the I index to the shift register.

The while loop is the most efficient way I can think of to do this
because the array is an array of clusters so that you have to index
the array BEFORE you can unbundle by name. Thus, you can't really use
search 1D array as far as I know. (Unless they have made it so that
you can search a cluster array for a particular cluster value. Even
then, search 1D array would expect that all components in the cluster
element would have to match the search cluster and all you care about
is a name match.)

Doug De Clue
LabVIEW programmer
ddeclue@bellsouth.net


herbyhu wrote in message news:<50650000000800000007560000-1027480788000@exchange.ni.com>...
> I have a Cluster of two strings and one Integer: String.name
> String.value integer.time. I want to do a search for a specific
> String.name and then start to work with the cluster at this position.
> Is this possible with simple unbundle by name search in a whileloop
> for the needed name and then wire the cluster to the output?. I cant
> and dont want to change the structure of the Cluster itself (to many
> dependances)! Any suggestions will be nice
0 Kudos
Message 7 of 8
(3,041 Views)
Thank you all for your suggestions.
Doug can you please post a small example how your solution is looking (labview6.0 (how to index the cluster))
thanks again
0 Kudos
Message 8 of 8
(3,041 Views)