Help with search in 2D array

Hello
I find this code example in the forum and made few change to use it in my project , works great for me , it reads text file in to 2d array .

what i need to do is search for value in 2 d Array
For example search for the lowest value in the left (represent speed) i and show the value belong to him j (direction)
Find the lowest speed at what direction
Can any one help with this ?
Many appreciate & Thanks in Advance

// Example to read a two dimensional array.
//
#include <SPI.h>
#include <SD.h>
#define CS_PIN 10

// 5 X 4 array
#define ROW_DIM 150
#define COL_DIM 2

File file;

/*
 * Read a file one field at a time.
 *
 * file - File to read.
 *
 * str - Character array for the field.G
 *
 * size - Size of str array.
 *
 * delim - String containing field delimiters.
 *
 * return - length of field including terminating delimiter.
 *
 * Note, the last character of str will not be a delimiter if
 * a read error occurs, the field is too long, or the file
 * does not end with a delimiter.  Consider this an error
 * if not at end-of-file.
 *
 */
size_t readField(File* file, char* str, size_t size, char* delim) {
  char ch;
  size_t n = 0;
  while ((n + 1) < size && file->read(&ch, 1) == 1) {
    // Delete CR.
    if (ch == '\r') {
      continue;
    }
    str[n++] = ch;
    if (strchr(delim, ch)) {
        break;
    }
  }
  str[n] = '\0';
  return n;
}
//------------------------------------------------------------------------------
#define errorHalt(msg) {Serial.println(F(msg)); while(1);}
//------------------------------------------------------------------------------
void setup() {
  Serial.begin(9600);

  // Initialize the SD.
  if (!SD.begin(CS_PIN)) {
    errorHalt("begin failed");
  }
  // Create or open the file.
  file = SD.open("READNUM.TXT", FILE_WRITE);
  if (!file) {
    errorHalt("open failed");
  }
  // Rewind file so test data is not appended.
  file.seek(0);
//* Write test data.
/
  file.print(F(
    "26,259\r\n"
    "21,220\r\n"
    "31,320\r\n"
    "41,350\r\n"
    "21,220\r\n"
    "31,320\r\n"
    "41,360\r\n"
    "21,22\r\n"
    "31,32\r\n"
    "41,42\r\n"
    "21,22\r\n"
    "31,32\r\n"
    "51,52,53,54"     // Allow missing endl at eof.
    ));
  
*/
  // Rewind the file for read.
  file.seek(0);

  // Array for data.
  int array[ROW_DIM][COL_DIM];
  int i = 0;     // First array index.
  int j = 0;     // Second array index
  size_t n;      // Length of returned field with delimiter.
  char str[20];  // Must hold longest field with delimiter and zero byte.
  char *ptr;     // Test for valid field.

  // Read the file and store the data.
  
  for (i = 0; i < ROW_DIM; i++) {
    for (j = 0; j < COL_DIM; j++) {
      n = readField(&file, str, sizeof(str), ",\n");
      if (n == 0) {
        errorHalt("Too few lines");
      }
     array[i][j] = strtol(str, &ptr, 10);
    if (ptr == str) {
       errorHalt("bad number");
     }
     while (*ptr == ' ') {
        ptr++;
      }
   //   if (*ptr != ',' && *ptr != '\n' && *ptr != '\0') {
    //    errorHalt("extra characters in field");
    //  }
     if (j < (COL_DIM-1) && str[n-1] != ',') {
        errorHalt("line with too few fields");
      }
  }
    // Allow missing endl at eof.
    if (str[n-1] != '\n' && file.available()) {
      errorHalt("missing endl");
    }    
  }

  // Print the array.
  for (i = 0; i < ROW_DIM; i++) {
    for (j = 0; j < COL_DIM; j++) {
      if (j) {
        Serial.print(' ');
      }
      Serial.print(array[i][j]);
    }
    Serial.println();
  }
  Serial.println("Done");
  file.close();
}
//------------------------------------------------------------------------------
void loop() {
}

Can any one help with this ?

What is the problem? What help do you need?

I’ve already explained how to do that without storing all the data in the array. You ignored that advice, so why should anyone believe you’ll pay attention this time?

Hi
I can say that unfortunately I Didn't understand how to approach your advice which looks very efficient way , Also my level of programming is Low , very Low , so i need some code example to start with trial and error until success
I pay a lot of attention and respect to any Advice i get
Thanks

You have an array. When iterating through the array, the first element of the array is the smallest seen so far, right?

The rest of the elements are either smaller, and become the new smallest value, or not, and are pretty much ignored.

Can you figure out how to iterate through the array (using a for statement)?
Can you figure out how to determine if an element of the array is smaller than another value (using an if statement)?

If i Understand your approach :

Let say i start to log data speed + direction from 15 kmh speed.
I need to run a loop that every speed below 15km will log into ARRAY the Speed+ Dierction
While speed < 15
Push data to array speed+direction

My Array can contain maximum 60 item for example in 1 second loop
Then i need to pull from the array the last value in the array because he is the lowest one (lowes speed)
Or make a search inside the Array ?

with this method i can write to arduino memory and not use sd card ?

float GPSSPEED = gps.f_speed_kmph() ;
float COURSE = gps.f_course();

dataString = String(GPSSPEED) + “,” + String(COURSE) ; //

i need to push the datastring to array when the condition is truth ?
did i understand correctly ?

Thanks for helping

sketch uses 29,950 bytes (92%) of program storage space. Maximum is 32,256 bytes.
Global variables use 1,545 bytes (75%) of dynamic memory, leaving 503 bytes for local variables. Maximum is 2,048 bytes.
Low memory available, stability problems may occur.