05-27-2011 05:18 PM
Greetings,
I'm making a program to auto align a fiber cable to a waveguide. As of right now I'm only concerned with 2 axis. So I'm producing a table of 3 columns (X, Y, I) where "I" is my measured current based on how well my fiber lines up with my waveguide. I have about 1000 rows (this table is also saved to a .txt file). What It's doing right now is returning to me the highest value of I, but I need to know which row this highest value is in, and more importantly I need to be able to return the values of X and Y for this row- so that I can set the positioner to this coordinate. I'm really not very good with arrays, so I'm trying to do this using amateur techniques.
If anyone can help it would be much appreciated. But please keep in mind I'm a newbie when it comes to array stuff so please write with simple terms~.
Many Thanks,
Tony
05-27-2011 05:41 PM - edited 05-27-2011 05:42 PM
"Array min&max" will give you the max as well as the index of the max value, just slice out the relevant column and apply this function. Now use "index array" with the found max index to get the entire row from the original 2D array if needed.
If you want more details, please attach a simple VI containing a typical array as default data in a control.
05-28-2011 09:38 AM
Thanks for the reply, I did try using this function several times, but as I said I'm not very good with array's. I think I'm creating a crappy array. The program basically stores one row at a time as an array rather then the whole table. So when this function returns the values from the max min function it's only for a one row entry. I'm only writing one row entry at a time to a spreadsheet file. This is all contained in a while loop, so at every loop iteration it creates a new 1x3 (X,Y,I) array and just adds it to the spreadsheet file. The total number of rows (loop iterations) is not constant. My explanation is probably not very clear, I'm tinkering with it today so I will try and create a small sample code of the area of interest and attach it tonight.
Much Thanks,
Tony
05-28-2011 10:22 AM
@tony.olivieri wrote:
My explanation is probably not very clear, I'm tinkering with it today so I will try and create a small sample code of the area of interest and attach it tonight.
Yes, please do.
05-31-2011 01:43 PM
Hi Tony,
Sounds like you're on the right-track, but it'd be nice to know exactly what you're after and how you're currently trying to implement the feature. Thus, if you're still having trouble, any type of screen shot or actual VI you could attach to show what your code looks like would be very much appreciated.