LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sorting into "buckets"

 I want to create a strategy to sort data into "Buckets'. The immediate need is that I will have a user select a few different analog output channels and I want to sort these out by card. So a list of

Card1_ao1

Card1_ao2

Card3_ao1

Card2_ao5

card1_ao5

card2_ao4

card3_ao4

 

would become

Card1=ao1,ao2,ao5

Card2=ao4,ao5

Card3=ao1,ao4

 

Basically I am going through a 2d array and creating a bucket based on the first value, and throwing and sorting out any duplicates into it in the form of a 1D array with a name.

 

What is the best way to acomplish the task above if the different buckets may be different length arrays? Am I best off using a local variable, a cluster or what? If a cluster is the way to go, does anyone have a good link to a way to programmatically change and bundle by name? I have to think there is a pretty simple way of doing what I want to do. If I were in matlab which is where a mechanical engineer I learned to program  I would just declare a variable "Card1" as an array and add to it. If card #2 comes along and I don't have any variable set I would declare a card #2 array and so on. How do I best do this in Labview?

 

 

0 Kudos
Message 1 of 10
(3,609 Views)

A Cluster of 1D arrays is the easiest way to simulate a "Ragged 2D Array" in LabVIEW. See Darrens nugget here


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 10
(3,598 Views)

I would use an array of clusters.  Each cluster would contain a string and an array.

 

The string would contain the name of a card.  The array would contain the names of the channels on that card.

 

The overall array is so that you can have an unspecified number of cards.

 

See attached LV12 file.

0 Kudos
Message 3 of 10
(3,592 Views)

Thanks for the quick replies, I have a meeting shortly but will see if I can either get this to work today or if not on monday. RavensFan, thanks for sending the vi. however is it possible for you to send that in a 2011 version or at least a picture?

 

Thanks,

 

Adam

0 Kudos
Message 4 of 10
(3,584 Views)

in 2011


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 10
(3,578 Views)

Thanks Jeff,

 

I don't have much time to play with this one anymore today so will have to get back to it on monday. None the less that looks about what I want the finished display to look like, the challenge now is taking in an array where Collumn #1=card# and Collumn#2=ao# and then turning it into the output that you showed there. I took a look at the Darren's occasional nugget and I think between the two of those I should be able to figure it out, however I am out of time for today. If anyone has any more to add or there is even a piece of out there that I can work off of that would be appreaciated otherwise it looks like you guys gave me a good enough start but I am out of time.

 

Thanks,

0 Kudos
Message 6 of 10
(3,573 Views)

HI, i have been following this post and i was wondering if it is possible that once the sorting has been done according to buckets,can a signal be sent to a comm port from labview and also is it possible to make it more interactive. For example, i want to input data and sort it by buckets and then sent a particular signal to a port according to the bucket that has just been selected.

0 Kudos
Message 7 of 10
(3,491 Views)

HI, i have been following this post and i was wondering if it is possible that once the sorting has been done according to buckets,can a signal be sent to a comm port from labview and also is it possible to make it more interactive. For example, i want to input data and sort it by buckets and then sent a particular signal to a port according to the bucket that has just been selected.

0 Kudos
Message 8 of 10
(3,490 Views)

Of course you can.  You are the programmer so just about anything is possible according to your imagination.  You just need to program it to do what you want.

0 Kudos
Message 9 of 10
(3,482 Views)

how can i achieve? should i simply modify the vi sent previously on the same discussion? btw i am a beginner, ive only started using labview since a week now

0 Kudos
Message 10 of 10
(3,474 Views)