Hi everyone,
I'm using a force transducer to measure finger presses. This device gives me continuous data across 10 channels (one column for each finger) and I want to identify where any presses reach a threshold.
Currently, I index using my threshold and receive a logical matrix of 1s and 0s, where 1 is above threshold. How can I identify these as presses, where a channel may reach threshold once, descend to below threshold, and then exceed the threshold again, which would count as 2 presses? Currently participants are only required to make one press per finger, and I'd like to punish them on any trials where they make any additional presses.
Thanks in advance,
Rhys

 채택된 답변

Jon
Jon 2020년 2월 10일

1 개 추천

Let's say you call your continuous data from one channel x (you can generalize this later to a matrix over the 10 channels).
Lets find all the points that are over the specified threshold and call these isPress
isPress = x>threshold
Now you want to find all the instances where it goes from not being pressed to being pressed. You can do this using diff
transition = diff(isPress) % will be 1 when goes to press level and -1 when it goes back to normal
You can count how many positive transitions, which is the number of times the key is pressed using
numPress = sum(transition==1)
I assume that when you say "I'd like to punish them on any trials where they make any additional presses". That this only means taking away points, or something like that. I certainly wouldn't want to help with any experiment that actually involved physical or any other form of actual "punishment"

댓글 수: 1

Rhys Yewbrey
Rhys Yewbrey 2020년 2월 11일
This is brilliant, thank you Jon. Working as intended.
You're correct, we're deducting points for excessive numbers of presses. Any other kind of punishment wouldn't make it past ethics I'm afraid!
Thanks again,
Rhys

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

질문:

2020년 2월 10일

댓글:

2020년 2월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by