Turning data in time domain into percentage

조회 수: 4 (최근 30일)
Jake Bowd
Jake Bowd 2019년 10월 8일
댓글: Peter Perkins 2019년 10월 15일
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
Peter Perkins
Peter Perkins 2019년 10월 15일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Adam Danz
Adam Danz 2019년 10월 9일
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
Jake Bowd
Jake Bowd 2019년 10월 9일
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 2019년 10월 9일
편집: Adam Danz 2019년 10월 10일
"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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by