Turning data in time domain into percentage

11 views (last 30 days)
Hi,
I am looking to turn a table of data (namely the 'mot1' table in the .mat file attached) into percentages, Does anyone have suggestions?
Best wishes,
  1 Comment
Peter Perkins
Peter Perkins on 15 Oct 2019
Jake, not sure if this would make your data easier to manage, but it's possible to use mergevars to put, for example, all the pelvis variables into one (inner) table inside of your mot1 table. You'd end up with an outer table that had fewer variables, each of which was itself a table.

Sign in to comment.

Accepted Answer

Adam Danz
Adam Danz on 9 Oct 2019
I'm guessing your time column represent a portion of the day (ie, hh:mm) and it's that column that you want to turn into a percentage.
datestr(mot1.time(1:5))
ans =
5×8 char array
' 6:36 AM'
' 6:47 AM'
' 7:00 AM'
' 7:12 AM'
' 7:23 AM'
in which case, they already are a percentage. Do you want to scale them from 0:100 instead of 0:1? It may be better to leave them in their original form if you want to use them as datetime values. But here's how to scale them to 0:100
mot1.time = mot1.time*100 % or mot1.time = round(mot1.time*10)
mot1.time(1:5)
ans =
27.5
28.333
29.167
30
30.833
If you want actual '%' symbols you'd have to convert them to strings | char arrays
mot1.time = strcat(num2str(round(mot1.time*100)),'%')
%or
mot1.time = cellstr(strcat(num2str(round(mot1.time*100)),'%'))
But again, they would be virtually worthless in that form if you're planning on using them for analysis.
If you need them as lables, you can always add an additional column to the table.
  2 Comments
Jake Bowd
Jake Bowd on 9 Oct 2019
Hi Adam,
I should have said. The time column is the length of a recording, and in each file the time length of the recordings with be different and so I would like to standardise the time column to be out of 100 (and so when I plot the graphs, each x axis is out of 100). In fact, once done for the time column I would be making all the other columns the same length as the newly modified time column.
essentially, I am looking at human movement and wish to analyse the stance phase of each gait cycle.
I hope this clarifies it?
Adam Danz
Adam Danz on 9 Oct 2019
Edited: Adam Danz on 10 Oct 2019
"The time column is the length of a recording"
Does that mean mot1.time are durations? In minutes? They appear to be montonically increasing as if they are time stamps (in what units?).
"in each file the time length of the recordings [will] be different and so I would like to standardise the time column to be out of 100"
Is the file you attached file #1? This file starts at mot1.time(1) = 0.275. In order to normalize it I'd need to know that max time across all files, if I'm understanding it correctly.
"once done for the time column I would be making all the other columns the same length as the newly modified time column."
I didn't understand this one.
Maybe an example would help explain the goal.

Sign in to comment.

More Answers (0)

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!