for loop and if-statement

1 回表示 (過去 30 日間)
Slane Haltine
Slane Haltine 2020 年 10 月 15 日
回答済み: Rafael Hernandez-Walls 2020 年 10 月 15 日
I have a device to detect heelstrikes that was used over 20s.
It last recorded the following measurements: 0.5s 1.51s 2.6s 3.65s 4.71s 6.8s 7.9s 9.1s 10.3s 11.1s 12.3s 15s 16.2s 17.3s 18.5s 19.6s
It sometimes misses a heelstrike which is evident when the interval between two measurements is > 1.5s
I want to write a code to generate a list that indicates when the heel strike was missed (0 = missed and 1 = okay)

採用された回答

Rafael Hernandez-Walls
Rafael Hernandez-Walls 2020 年 10 月 15 日
This may help you
Time=[0.5 1.51 2.6 3.65 4.71 6.8 7.9 9.1 10.3 11.1 12.3 15 16.2 17.3 18.5 19.6];
dife=diff(Time);
heelstrike=(dife>1.5).*0+(dife<=1.5).*1

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by