10-09-2012 01:31 AM
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.
Solved! Go to Solution.
10-09-2012 03:40 AM
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.
10-09-2012 07:57 AM
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.
10-09-2012 08:17 AM - edited 10-09-2012 08:18 AM
Does this help?
Remember, the row/column index always starts with 0.
10-09-2012 08:17 AM
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?
10-09-2012 08:20 AM
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.
10-09-2012 08:21 AM
Use the ActiveCell property to select the single cell (row,column), then use the CellBGColor property to set the color of that cell.
10-09-2012 08:24 AM
If you want to change the background color of a cell you need to work with property nodes:
10-09-2012 08:24 AM - edited 10-09-2012 08:24 AM
@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.
This might also work:
10-09-2012 08:31 AM
Yeah, even simpler
Thanks! Could have hit on it for myself!!