Use a grid/image get positional inputs and measure time in-between clicks.

3 views (last 30 days)
I was wandering whether it is possible to to use an image to get coordinate inputs for matlab and measure the time inbetween the responces at the same time.
For an example take a 10 by 10 grid. The user is asked to select a 5 points in the grid and coordinates of these 5 points will be recorded with the time it took to select each cordinate. So 5 (x, y) cordinates and 5 time intervals (from start to 1st point, 1st point to 2nd point, 2nd point to 3rd point, etc).
I'm aware that getpts(fig) function can be used to get the (x,y) cordinates but it doesn't return any time parameters. I tried playing with the built in code for getpts function trying to change it so I could also record the time but it seems it is impossible to change it in the way I need.

Accepted Answer

Chunru
Chunru on 26 Sep 2022
Edited: Chunru on 26 Sep 2022
You can make your function based on ginput or getpts. Edit one of these matlab functions and add the output argument of t and record down the time information at each click of mouse button.
% based on ginput
% 1. edit ginput.m
% 2. save as myginput.m
% 3. change function definition tp: [out1, out2, out3, t] =myginput(arg1)
% 4. add t=[]; after y=[] at line 30
% 5. add t=[t; datetime('now')] a line 143 after out1=[out1; pt(1,1)]
% then run: [x,y,b,t] = myginput

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by