LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

search row and column for return value

Dear Sir/Madam,
                           I have a problem for searching spreadsheet and hope you can help me out a bit.  Im pretty new to Labview and Im currently using Labview 8.0.  My task is to search the spreadsheet I have attached in row and column-wise, then return the corresponding value out.  I had an attempt in doing this as you can see from the vi that i have attached.  I try inputting the 'read from measurement file' into an array and using delete, index and search array I will be able to find the index value for the relevant row and column that i searched for by inputting them into an index array with the orginal array from the 'read from measurement file'.
                          So ultimately, when i enter a row value of 0.5 and a column value of 0.3, my output will be 1.688.
                          I can't see any mistakes in my logic but I getting really strange results, like I can read my data has been entered into an array but when i try deleting the first column and put it into another array, the orginal array with nothing deleted is outputted hence making my search to give out -1 value. So could you take a look please and give me any suggestion that can solve my problem or enhance the code a bit.  Thank you for your time.

Best Regards,
Coato

P.s for some reason i can't attached the .lvm file of my data hence i have attached the excel version but i think you need to convert it back to .lvm for the 'read from measurement file' function to work.
Download All
0 Kudos
Message 1 of 21
(4,270 Views)

Your VI makes absolutely no sense to me, but maybe I don't understand what you are trying to do.

You seem to have dynamic data with 6 signals and 48 points/channel. Now you reshape this into an array of dynamic data with 4x13 elements from which you slice out one row or column, resp. "delete from array" is NOT the correct tool to do this, use "Index array" with one index unwired to get a row or column as 1D array.

So you end up with two 1D arrays of dynamic data that you search for DBL. It is difficult to understand how you want to search for an array element that corresponds to a scalar DBL value of 0.1. Your array elements are NOT DBLs but dynamic data, each containing many signals!

There are two elements on all your data that are "3", the rest are zero. You will never find anything that is 0.1.

Maybe you can convert your original dynamic data to a 2D array with "rows are signals" using "convert from dynamic data", then operate on the 2D array.



Coato wrote:
                          So ultimately, when i enter a row value of 0.5 and a column value of 0.3, my output will be 1.688.

Sorry, Please explain.
 
Please make a VI containing a simple 2D aray as diagram constant that contains e.g. 5x5 typical values. Let us know what kind of result you expect from your algorithm..
 
0 Kudos
Message 2 of 21
(4,261 Views)


altenbach wrote:

...Now you reshape this into an array of dynamic data with 4x13 elements ...


Sorry, you are actually initializing this into an array of dynamic data with 4x13 elements (each element is identical and corresponds to 6 signals/48points) . Since all array elements are the same, you would not find anything unique useful using search array!
0 Kudos
Message 3 of 21
(4,256 Views)
Hi altenbach,
                  
0 Kudos
Message 4 of 21
(4,241 Views)
Hi Altenbach,
                     Thank you for your reply, im sorry for my ignorance but I tried the design again with your advice and I believe I have almost got it now except the last part.  So basicially I take out the first row and the first column of the spreadsheet using 'index array', based on what my search values are, the 'search array' function gives me an index value back.  With 2 index values; the row and column from the search array, I will be able to pinpoint the exact value I need from the spreadsheet.  However,  Im not sure how to perform such a task, I try using string conversion to get the value but I also need the result value in numeric type as I need it to be entered into another equation.  Please let me know what you think.  Thank you for your time.
 
Best Regards,
Coato
0 Kudos
Message 5 of 21
(4,239 Views)
Where are you trying to do string conversions?  Once you've gotten your row and column index, you are using index array to get a value.  That value is already a double precision numeric.
0 Kudos
Message 6 of 21
(4,225 Views)
Hi Raven,
               Thank you for your reply, I tried string conversion but it wasn't getting anywhere therefore I just left it out.  I understand that it's in double precision numeric but im not getting the result I needed.  Say if I input a row value of 0.5 and a column value of 0.2, Im expecting a value of 1.468 to be returned in my results box but unfortunately im not getting that at all Smiley Sad
                My intial thought is that using string i will be able to read the data and with string input, string will be outputted then I will need some kind of conversion to convert it back to numeric format in order to enter it into a formula.  Hope I explained it okay.  Please let me know what you think.  Thank you for your time.
 
Best Regards,
Coato
0 Kudos
Message 7 of 21
(4,217 Views)
oh i got it working, seems I have misplaced the two index values in the end. Smiley Very Happy  Thank you for the help.
 
Best Regards
Coato
0 Kudos
Message 8 of 21
(4,213 Views)

hey coato

 

how did you fix it. I need a similar program. Could you post it.

 

Thanks a lot

0 Kudos
Message 9 of 21
(3,905 Views)

Oli,

You just need to use an 'index array' function.

Wire your array to the input, then enter what row and column you want to get the value for.

You can use 'array subset' if you want an entire row or an entire column. 

Or are you trying to search an array for which coordinates contain a specific value?
Message Edited by Cory K on 01-15-2009 11:47 AM
Cory K
Message 10 of 21
(3,900 Views)