# Splitting exercise data into selectable portions

Page 1 of 1

## 5 Replies - 438 Views - Last Post: 08 May 2013 - 07:49 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=320546&amp;s=0a188bd58b05883d73eac66eb111903e&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 bucky112

Reputation: 0
• Posts: 9
• Joined: 04-March 13

# Splitting exercise data into selectable portions

Posted 08 May 2013 - 04:17 AM

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
Is This A Good Question/Topic? 0

## Replies To: Splitting exercise data into selectable portions

### #2 Skydiver

• Code herder

Reputation: 4368
• Posts: 14,096
• Joined: 05-May 12

## 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 bucky112

Reputation: 0
• Posts: 9
• Joined: 04-March 13

## 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

### #4 Skydiver

• Code herder

Reputation: 4368
• Posts: 14,096
• Joined: 05-May 12

## 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.

### #5 bucky112

Reputation: 0
• Posts: 9
• Joined: 04-March 13

## 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.

### #6 Skydiver

• Code herder

Reputation: 4368
• Posts: 14,096
• Joined: 05-May 12

## 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:
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++)

for(int i = endOfWarmUp; i < startOfCoolDown; i++)