42 lines
1.1 KiB
Matlab
42 lines
1.1 KiB
Matlab
function[e] = onClickPlotAxes(varargin)
|
|
|
|
e = varargin{1};
|
|
obj = varargin{2};
|
|
handle = varargin{3};
|
|
|
|
location = get(obj, 'CurrentPoint');
|
|
|
|
previous_location = get(obj, 'UserData');
|
|
|
|
|
|
subj_pop = findobj('Tag','subj_pop');
|
|
sess_pop = findobj('Tag','sess_pop');
|
|
|
|
tmpsubj=get(subj_pop, 'Value');
|
|
if (iscell(tmpsubj)), selsubj = tmpsubj{1}; else selsubj = tmpsubj;end;
|
|
tmpsess=get(subj_pop, 'Value');
|
|
if (iscell(tmpsubj)), selsess = tmpsess{1}; else selsess = tmpsess;end;
|
|
if isempty(selsess) selsess = 1; end; if isempty(selsubj) selsubj = 1; end;
|
|
e.subjects(selsubj).sessions(selsess).sampling_rate
|
|
|
|
sampling_rate = e.subjects(selsubj).sessions(selsess).sampling_rate;
|
|
|
|
new_location.x = location(1,1);
|
|
new_location.y = location(1,2);
|
|
|
|
if isfield(previous_location, 'x');
|
|
delta_t = abs(new_location.x -previous_location.x);
|
|
units = 'ms';
|
|
if (delta_t > 1e3)
|
|
units = 's';
|
|
delta_t = delta_t/1e3;
|
|
|
|
end
|
|
display(sprintf('Delta time : %3.2f %s', delta_t, units));
|
|
|
|
end
|
|
|
|
previous_location = new_location;
|
|
|
|
set(obj, 'UserData', previous_location);
|