SearchHighestArrayCell
SearchHighestArrayCell SearchArray(), StartElement, ElementDelta, Number, SearchLimit
 
Parameters:

    SearchArray() = The Array you wish to search
    StartElement = The address of starting element
    ElementDelta = The difference between elements
    Number = The number of elements you wish to search through
    SearchLimit = The lower most value, for search result should be higher than
Returns: NONE
 

      The SearchHighestArrayCell function searches an array for the highest value. For the search to be true (return a found result) the searched values are matched against SearchLimit parameter. Values need to be higher than this limit before being consisdered.

      SearchHighestArrayCell can only be used upon Integer and floating point arrays.

      When SearchHighestArrayCell locates the highest element it will return the number of steps it took to find this element from the starting location.




FACTS:


      * SearchHighestArrayCell returns a -1 if no matches were found.

      * When SearchHighestArrayCell finds the highest element, it returns the number searche steps that were required from the starting point.

      * SearchHighestArrayCell can be used upon Integer,Floating Point arrays.

      * SearchHighestArrayCell is much faster than manually searching array elements yourself.



Mini Tutorial:


      This example creates an array called Table() and fill it with 10 random values, ranging from 0 to 1000. Then it locates the highest and lowest values in this array.


  
; Create a 1D Array...
  Dim Table(10)
  
; Fill & Display the table() array
  For lp =0 To 10
     Table(lp)=Rnd(1000)
     Print Table(lp)
  Next
  
; Search for the lowest value (lower than 1000) in
; the table() array
  LowestOffset= SearchLowestArrayCell(Table(),0,1,10,1000)
  
; Display it's offset
  Print " Found Lowest at position:"+Str$(LowestOffset)
  
; Search for the highest value (higher than 0) in
; the table() array
  HighestOffset= SearchHighestArrayCell(Table(),0,1,10,0)
  
; Display it's offset
  Print " Found Highest at position:"+Str$(HighestOffset)
  
; Show the Display and wait for a key press
  Sync
  WaitKey
  
  


      Since this example uses random values, it's output will differ each time it's run. So the following are just for the sake of an example

  
  583
  405
  528
  51
  377
  492
  271
  187
  275
  809
  396
  Found Lowest at position:3
  Found Highest at position:9
  




 
Related Info: FindArrayCell | SearchLowestArrayCell :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com