LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Output element below the found element

Solved!
Go to solution

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!

0 Kudos
Message 1 of 8
(2,790 Views)

Hi yeshani,

 

when you found your index what's the problem in incrementing the index to pick the next element?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 8
(2,787 Views)

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.

 

 

 

 

 

 

Message 3 of 8
(2,786 Views)

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]

0 Kudos
Message 4 of 8
(2,783 Views)

Yes, but is there a function that would return output an element, given its index?  Thanks guys!

0 Kudos
Message 5 of 8
(2,767 Views)
Solution
Accepted by topic author ywij

Yes, that's the "Index Array" function.

 

0 Kudos
Message 6 of 8
(2,763 Views)

 

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

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
Message 7 of 8
(2,761 Views)

I do this thing all the time.  Use a Search 1D Array and Index Array.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 8
(2,742 Views)