Jump to content

Can I make an array with strings and doubles?


Recommended Posts

Hello everyone. New here. Hi.

Hey I'm doing a project in my LabVIEW class to program a 'Pinewood Derby' racetrack. I won't explain the whole thing, that would get boring.

I really just want to know how I could make an indexable, sortable array with one column being a string - the name of the car/racer, and the other column being the car/racer's race time. I've tried to just turn my number into a string, then concatenating both strings and stuffing them into my array. But then I can't sort my array in order of race time (it's going to have several racers' times in the same array) because the only relevant node I could find only dealt with numeric arrays. :throwpc:

I would really appreciate some help on this. My partner and I both are a little stumped. Thanks in advance!

-Scooter

Link to comment

Hi Scooter X,

You can use a cluster with one string and one numeric for each racer build an array of this for your data. Clusters allow you to keep different data type elements together.

As far as the sorting goes I am not aware of any ready made functions for sorting a cluster. You may have to write custom code for sorting your cluster, but should not be very challenging.

Justin Thomas

Link to comment

QUOTE (JustinThomas @ Apr 8 2009, 12:57 PM)

Hi Scooter X,

You can use a cluster with one string and one numeric for each racer build an array of this for your data. Clusters allow you to keep different data type elements together.

As far as the sorting goes I am not aware of any ready made functions for sorting a cluster. You may have to write custom code for sorting your cluster, but should not be very challenging.

Justin Thomas

You can sort a 1D cluster array with the native LabVIEW function.

Link to comment

Thanks guys for your suggestions. I did actually try a cluster yesterday, but it was giving me a bit of a fit too... I'll keep trying. That's what made the most sense to me as well. And yea then I'd have to try something of my own to sort it out properly. I'll keep trying and I'll let my amigo know what's up too, maybe he has some other ideas by now. Thanks, guys! I'll likely be back later for something else. Take care for now. :thumbup:

Link to comment

QUOTE (Scooter_X @ Apr 8 2009, 06:54 AM)

And yea then I'd have to try something of my own to sort it out properly.

No, the sorting is easy! As the others mentioned 1D Sort Array works great on clusters. Be sure to read the help about it, and post back if you have difficulty.

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.