SearchLowestArrayCell
SearchLowestArrayCell 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 upper most value, for search result should be lower than
Returns: NONE
 

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

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

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




FACTS:


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

      * When SearchLowestArrayCell find a matching element it returns the number searches that were required from the starting point.

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

      * SearchLowestArrayCell 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 | SearchHighestArrayCell :
 


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