09-12-2012 03:28 PM
I just started labview a couple weeks ago. I am trying to do a vi where I input a number and it would return me a different number which i have previously saved in an excel spreadsheet.
So, I used the Read from Spreadsheet function to read my saved spreadsheet and do an array. And I connected it to a Search 1D Array and connected the first row of my array to the Search 1D Array function. So, I know this would produce the index of the searched element. But, what I am actually looking to output is the element in the next cell.(same row, right column). Do you guys know of any way that I could do it?
Thanks a lot in advance!
Solved! Go to Solution.
09-12-2012 03:32 PM
09-12-2012 03:37 PM
It would be easier if we could take a look at your code....
One simple way to do this would be to make two 1D arrays. The first array contains the first column, that you search in. The second array is the column you want to return the value from.
Search the first colum and find the index. Then, wire that over to your second array to pull out the value you wanted using the Index Array function.
09-12-2012 03:41 PM
Gerd,
That would give him the next element in the same 1D array.
He wants the corresponding element in the next array.
Instead of A[i+1], he wants B[i].
Or, we could say he locates A[i,j] and is looking for A[i,j+1], not A[i+1,j]
09-12-2012 11:01 PM
Yes, but is there a function that would return output an element, given its index? Thanks guys!
09-12-2012 11:05 PM
Yes, that's the "Index Array" function.
09-12-2012 11:06 PM - edited 09-12-2012 11:07 PM
Yeshani wrote:
Yes, but is there a function that would return output an element, given its index? Thanks guys!
It is Index Array Function
Function palette>>Array>>Index Array
09-13-2012 06:57 AM - edited 09-13-2012 06:57 AM
I do this thing all the time. Use a Search 1D Array and Index Array.