How to analyze different segments in a timetable?.

2 ビュー (過去 30 日間)
Frank Pernett
Frank Pernett 2021 年 10 月 6 日
コメント済み: Star Strider 2021 年 10 月 7 日
Hi I have a timetable with different physiologic measurements (example attached).
The first column is duration in seconds, and the last column is a time marker that means: 0 is off and 5 is on. When time marker is on, means that the recordings corresponds to the experiment. The other columns are physiological variables as the figure shows.
As the Time Mark shows we had 10 experiments. I would like to have advice on the best way to extract the duration of every experiment.
Thanks
  2 件のコメント
Frank Pernett
Frank Pernett 2021 年 10 月 7 日
Thanks!!
Star Strider
Star Strider 2021 年 10 月 7 日
As always, my pleasure!
.

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2021 年 10 月 6 日
Try this —
LD = load('timetable.mat');
AB001 = LD.AB001;
ExptMarker = AB001.fTimeMark; % Marker Vector
Lv = ExptMarker>0; % Logical Vector
ExptStart = strfind(Lv', [0 1])+1; % Start Indices
ExptStop = strfind(Lv', [1 0]); % Stop Indices
ExptIdxMtx = [ExptStart; ExptStop]'; % Index Matrix
ExptTimes = AB001.time(ExptIdxMtx); % Time Matrix
ExptDuration = ExptTimes(:,2) - ExptTimes(:,1) % Duration Vector
producing:
ExptDuration =
10×1 duration array
53 sec
70 sec
69 sec
77 sec
77 sec
91 sec
101 sec
107 sec
110 sec
121 sec
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by