X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 05 Mar 2014 01:07 AM by  anon
array indexing not working for a specified range with min()
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
05 Mar 2014 01:07 AM
    I know a value in an unsorted array "a[158,1]" and want to find it's index.in my code; i have used : min_refl=min(a[(S1-1):(S2-1),1],location) ; to find minimum for a specified range in array a indx=ARRAY_INDICES(a,location) ; to obtain the index of the minimum value obtained print,a[indx[0],indx[1]],indx. The indexing seems to work with the entire array but not for the selected range.Please suggest any other function if available.

    Berangere Casson



    New Member


    Posts:61
    New Member


    --
    05 Mar 2014 08:02 AM
    I made a small test with the following line of codes a= transpose(indgen(10)) help,a Output is A INT = Array[1, 10] (with values going from 0 to 9) If I look for the max index on the full array: test=max(a,location) print,array_indices(a,location) The output is 0 9 If I now look for the MAX of the first 5 elements of the array test= max(a[0:4],location) print,array_indices(a,location) The output is 0 4, which seems correct Do you see a different result ?
    You are not authorized to post a reply.