LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arrays and table data

Solved!
Go to solution

Hello -

 

How come when I create a value property node from a table and build an array from that value property node, it gives me an appended array?

I've tried indexing into the array twice to get a single row of values but when I try to compare the 1st index of that row from the table with the

first index value of an array of the same size, the equal sign will not take the putout from the index array created from the table. I see that the

output wire is pink, which means the value is considered text..how do I convert that to a number so that I can compare the first value from a row

in a table to the first value from an array of one row to determine if they are equal? The array index is being fed data from points coming from

a graph and once that 1st index value of the array matches the first index value from the row in the table, I'm hoping to have that particular index in the array

turn green when there is a match. Thanks.

0 Kudos
Message 1 of 13
(3,702 Views)
Solution
Accepted by topic author mechqueen

Hi

I'm not absolutely sure wheter I got you right. Posting a VI or a screenshot might have been helpful...

However, attached you can find a simple VI to compare the first value of a desired table row to the first value of an array.

Note that the table data type is string, not numeric. No matter if you put numeric values into the table it will still remain string. That's why a conversion will be necessary to compare the table values to numeric values.

The table values appear as a 2D array in which the first dimension contains the rows (x).

I hope I could help you on this.

0 Kudos
Message 2 of 13
(3,688 Views)

Hi there. Thank you so much for your suggestion. Your simple program does work well. I was initially attempting to write all of the table values to an array, and then index the first value from that resultant array to compare it to the first index of the regular array values. I knew I needed to convert the string but I didn't see how. Now I see the convert to decimal string works for that. Also, I didn't know how to actually pull the value from the array created from the table, but you show how to do that very well also. Thank you. The whole indexing thing perplexes me sometimes. The reason why you indexed two values for the index table array is because it's 2 dimensional..so you had to specify the first row, and then the first number in that row..whereas for the index array for the 1D array only needed one input (an index value) for the one row. What if I wanted to index the first column, and say..the 2nd or 3rd number from the table array..how would you do that? I have read up on indexing arrays and for some reason the way Labview does can be confusing. Thanks again.

 

0 Kudos
Message 3 of 13
(3,655 Views)

Does this help?

 

Remember, the row/column index always starts with 0. 

 

 

 

 

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 4 of 13
(3,646 Views)

Hi, I have one other question. If the values match up, I am trying to assign just that index of the table to a different color as a signal to the user but my color is not changing. Do you know what I could be doing wrong?

 

 

0 Kudos
Message 5 of 13
(3,644 Views)

Many thanks for the feedback!

Reading a single column of a table is quite simple. It's an idea based on my VI posted above. I think you could have hit on it for yourself. Smiley Happy

Indexing_Column_Values.png

0 Kudos
Message 6 of 13
(3,640 Views)

Use the ActiveCell property to select the single cell (row,column), then use the CellBGColor property to set the color of that cell.

 

 

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 7 of 13
(3,638 Views)

If you want to change the background color of a cell you need to work with property nodes:

CellColor.png

0 Kudos
Message 8 of 13
(3,636 Views)

@BrotherTom wrote:

Many thanks for the feedback!

Reading a single column of a table is quite simple. It's an idea based on my VI posted above. I think you could have hit on it for yourself. Smiley Happy

Indexing_Column_Values.png


 

 

 

 

 

 

 

 

 

 

 

This might also work: Smiley Wink

 

 

 

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 9 of 13
(3,636 Views)

Yeah, even simpler Smiley Surprised

Thanks! Could have hit on it for myself!! Smiley LOL

0 Kudos
Message 10 of 13
(3,626 Views)