Hi, I currently have a programme that reads in data from essentially a text file. It tells me data such as heart rate and speed from my exercise routine and populates a Datagrid. With this data I can produce simple graphs. I'm needing help on the process that I would need to be able to split this data into say three parts, Start\middle\end, from this I could work out a number of averages.

Thanks

# Splitting exercise data into selectable portions

Page 1 of 1## 5 Replies - 559 Views - Last Post: 08 May 2013 - 07:49 AM

##
**Replies To:** Splitting exercise data into selectable portions

### #2

## Re: Splitting exercise data into selectable portions

Posted 08 May 2013 - 05:18 AM

How do you determine what is in each region? Number of minutes into the exercise? Number of samples? Or do you compute the first derivative of the speed (to get the acceleration) and find the inflection points to figure out when the person started to speed up to go from the starting warm up to the faster pace of the exercise and to the transition to cool down?

### #3

## Re: Splitting exercise data into selectable portions

Posted 08 May 2013 - 05:26 AM

Hi,

I was going to take the number of samples per exercise cycle to work out the start/middle/end because each routine could be relatively short or long. What would be the best method for implementing this?

Thanks

I was going to take the number of samples per exercise cycle to work out the start/middle/end because each routine could be relatively short or long. What would be the best method for implementing this?

Thanks

### #4

## Re: Splitting exercise data into selectable portions

Posted 08 May 2013 - 05:34 AM

Personally, though, I recommend keep the data within a list and doing your analysis over the list. Using UI controls to act as data containers or variables is really a poor idea which unfortunately was the teaching style for the VB generation of programmers.

If you approach it from the number of samples, you could arbitrarily say that the first 10% of the samples is the start, the middle 75% is the middle, and the last 15% is the end. So if you had 100 samples, that would correspond to rows 1-10, 11-75, and 76-100.

If you approach it from the number of samples, you could arbitrarily say that the first 10% of the samples is the start, the middle 75% is the middle, and the last 15% is the end. So if you had 100 samples, that would correspond to rows 1-10, 11-75, and 76-100.

### #5

## Re: Splitting exercise data into selectable portions

Posted 08 May 2013 - 05:42 AM

Hi,

Thanks again, I did consider splitting the list into percentages but what topic do I need to research in order to achieve this. I'm having a problem putting my ideas in computable terms that can be researched into.

Thanks again, I did consider splitting the list into percentages but what topic do I need to research in order to achieve this. I'm having a problem putting my ideas in computable terms that can be researched into.

### #6

## Re: Splitting exercise data into selectable portions

Posted 08 May 2013 - 07:49 AM

I recommend reviewing your book that taught you how to code in C#. You could code with the completely naive approach. In pseudo code:

The naive approach above can be compressed to a few lines using LINQ or the built in IEnumerable<T> extension methods.

double warmUpPercent = 0.10; double coolDownPercent = 0.15; int endOfWarmUp = warmUpPercent * samplesList.Count; int startOfCooldown = (1 - coolDownPercent) * samplesList.Count; for(int i = 0; i < endOfWarmUp; i++) warmUpList.Add(samplesList[i]); for(int i = endOfWarmUp; i < startOfCoolDown; i++) workOutList.Add(samplesList[i]); for(int i = startOfCoolDown; i < samplesList.Count; i++) coolDownList.Add(samplesList[i]);

The naive approach above can be compressed to a few lines using LINQ or the built in IEnumerable<T> extension methods.

Page 1 of 1