LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I put number elements of a listbox into an array for further manipulation

Hi.

I'm a noob here and need some help with my project. I am trying to build a GUI whereby the user can input into a 2 column list box the name of an appliance in the first column and the power rating in the second. I want to be able to use all the values in the second colum of the list box (power rating of each appliance) and put them into array where i can then perform power usage calculations etc.

Any help would be mostly appreciated.

Cheers
0 Kudos
Message 1 of 11
(4,454 Views)
Hello,

That's simple. Create a property node of the list box and select "item names". That return a 2D array.

Software developer
www.mcm-electronics.com





PORTUGAL
Message 2 of 11
(4,449 Views)
I've tried this but the selection of Item names returns a cell as a string...I want the value in the cell so that i can do math on it
0 Kudos
Message 3 of 11
(4,444 Views)
Then simply convert the string(s) to a number using one of the many string to number functions:


P.S. I hope you weren't the one who gave Jorge's response a 1-star rating. If so, please don't do that, as the response did not deserve a 1-star rating. It was a proper response.

Message Edited by smercurio_fc on 06-19-2007 09:14 AM

Message 4 of 11
(4,434 Views)
Thanks for the support Smercurio,

Sometimes with don't know the level of help that someone needs.
If really wants a complete example, I think that it should mentioned. But ok. We are just trying to help.

Best regards
Software developer
www.mcm-electronics.com





PORTUGAL
Message 5 of 11
(4,416 Views)
Thanks for that I got it working.

I got new questions.

You've shown me how to do it which is great but I don't know what is going on. When we create a property node what is it that we are doing exactly?

What I'm trying to do now is add the elements of the 2nd column of the list together. I've enclosed everything around a for loop. Using a constant value 1 connected to the column input of index array and the iteration counter "i" of the for loop as the input to the row connection of index array, I'm trying to get it working so that the for loop only iterates as many rows there are with data .
0 Kudos
Message 6 of 11
(4,376 Views)
I've modified your .vi.

I think that what you want it's to add all elements on second column. And that's what i've done in the attach
Software developer
www.mcm-electronics.com





PORTUGAL
0 Kudos
Message 7 of 11
(4,371 Views)
I would also suggest spending time with the LabVIEW tutorials, the books, as well as going over to the NI Developer Center Learning Zone to find other tutorials available online. Some of your questions are answered by going through this material, and in the long term you'll be a better programmer.
0 Kudos
Message 8 of 11
(4,367 Views)
Thanks for your reply but your version must be newer than mine as the file will not open due to incompatability. could you maybe take a screen shot instead.

cheers
0 Kudos
Message 9 of 11
(4,365 Views)
I am only a student and I am currently enrolled in a Labview course. I'm learning from tutorial exercises but I am at the same time trying to do a project for submission on Monday.
0 Kudos
Message 10 of 11
(4,365 Views)