LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use a 2d array to populate a Combo Box and Return a different value.

Solved!
Go to solution
Solution
Accepted by topic author montoya51

Good effort so far Montoya. No one here is a sadist, but we all know a little bit of struggle is often the best way to learn.

 

One thing that Dennis was pointing out was that the code that populates your ring control really only needs to happen once. Notice I've taken it out of the while loop. You could take the loop away, push start, it would execute once, populate your ring control and stop. But you probably want to do something after that so that's why this happens before you enter the while loop. The error wire can be used to make sure the while loop doesn't start until after the ring control is populated.

 

Put your mouse over your ring control property node and the context help shows you how the data needs to be assembled. It's a 1D array that has a cluser with two elements in it - a string and a DBL. So each element of those arrays you are trying to combine needs to be taken out of the array, combined into a cluser with the element from the other array, then that cluster combination needs to be put back into an array.

 

For loops are the best way to do that kind of thing. You'll find they are most often used for repetive operations on arrays. You can right click on the tunnel and disable the indexing. That will pass the entire array of data into the For loop. However, in your case you want the indexing enabled because you want that For loop to pull out each element of the array and process the elements one at a time before resassembling back into an array.

 

By the way, if you don't wire a number to the count terminal of the For loop it will run as many times as the smallest array has elements. So it stops once the smallest array wired into it with indexing enabled has reached the end.

 

That might be a lot to digest all at once, but it should give you jump start on the next part of your code.

 

Eric

 

Read input excel_BD.png

Message 11 of 13
(1,252 Views)

That was a big help. I didn't understand that I had to put the cluster together one step at a time. I understand the reason for the for loop and I also understand why it did not need to be in a while a loop. I was kind of doing that while I was figuring it out. If it continually runs then I could mess with the inputs till it worked. There are a couple of things in the code that I do not know how to insert or what they do. They are very small and one is DLB(number) and ABC. I don't know what they are for and how to use them. The VI now does what I need but I would like to expand my knowledge. Thanks so much for the help.

 

0 Kudos
Message 12 of 13
(1,242 Views)

The abc and the DBL just represent different data types.

 

abc: string - this is a sequence of symbols or characters like text

DBL - numeric, double-precision, floating point

 

This explains the different numeric data types. Each takes up a different amount of memory. If you only need to store integers there is no need to represent the data as a double (DBL).

http://zone.ni.com/reference/en-XX/help/371361D-01/lvhowto/numeric_data_types_table/

 

Math functions can't be performed on strings. You have to convert them to numeric data first.

Message 13 of 13
(1,239 Views)