Find exact time step
Ältere Kommentare anzeigen
I have two column one is time column and another is speed column. The speed is constant but when a subject starts running the speed increase. I want to know the exact time point when a subject start run using a MATLAB code. I collected five trials in one file. I want to know the five time steps from one file. Attached is the excel sheet.
Akzeptierte Antwort
Weitere Antworten (1)
Jos (10584)
am 4 Mär. 2016
Let S be your vector of speeds, and T your time points
% Determine, for each time point, is the subject running or not
IsRunning = S > 0 ;
% For each time point, did the subject change from not-running to running
TF = [false ; diff(IsRunning(:))==1] ;
% At what indices did this happen
index = find(TF)
% and the time points are:
T_startedToRun = T(index)
% check with a plot
plot(T,S,'b-', T_startedToRun,0,'rs') ;
1 Kommentar
Mahdi Hassan
am 17 Mär. 2016
Kategorien
Mehr zu Parallel Computing Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!