Finding maximum and minimum value analogRead

Hi.

In my current project i have a datalogger storing 16 different sensorvalues from analogRead. I have no problem in reading and saving the to SD card. I have made start and stop datalogging with a simple high, low pin.
Every time i start logging i creates a new file and stores the data every 1 second for as long as the pin is high.
But what i would like, is to do some data processing with the stored data. I would like to find the minimum and maximum value of each sensor and some how store them in a buffer, ready for when i call for the values. I need to create a buffer with these values for every time i save a new collection of data.
Like this:
LOGGER00.csv follow by LOGGER00MINMAX.csv
LOGGER01.csv follow by LOGGER01MINMAX.csv

I hope you understand what i am trying to do.

But my question , how should i do it?
I have thinking about 2 different scenarios:

1: Hopefully there is some function/library which is capable of opening a .csv file and find min and max (statistic lib).

2: Create a parallel loop, which starts when i start datalogging, and thus compare is new value to the old value. And i the the end i have 16 Max values and 16 Min values which can be stored in a new csv file.

Which of the two is the best solution? Or is there something much simpler and smarter that what i have been thinking about?

I hope you can help me.

Best regards Bastian Gaardahl

2: Create a parallel loop, which starts when i start datalogging, and thus compare is new value to the old value. And i the the end i have 16 Max values and 16 Min values which can be stored in a new csv file.

This is definitely the way to go, although there is no need for a "parallel loop". The comparisons can be done in the same loop that you use for collecting the data.

But why do you need a separate file for the min and max values? Any program that later reads the main data file can determine those values.

That you very much for the fast response.

The reason why i need to store min and max values is:

I am trying to create a large datalogging system for motorsport with a LCD screen. The idea is to be able to go back after each race to see the max and min values. Mostly the max values.

Best regards Bastian

The idea is to be able to go back after each race to see the max and min values.

Yes, but why put them in separate files ?