5 Replies - 259 Views - Last Post: 08 May 2013 - 07:49 AM Rate Topic: -----

#1 bucky112  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • 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  Icon User is online

  • Code herder
  • member icon

Reputation: 3469
  • View blog
  • Posts: 10,691
  • 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?
Was This Post Helpful? 0
  • +
  • -

#3 bucky112  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • 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
Was This Post Helpful? 0
  • +
  • -

#4 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3469
  • View blog
  • Posts: 10,691
  • 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.
Was This Post Helpful? 0
  • +
  • -

#5 bucky112  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • 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.
Was This Post Helpful? 0
  • +
  • -

#6 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3469
  • View blog
  • Posts: 10,691
  • 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++)
   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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1