[Eeglablist] Using ctrlselectcommand in eegplot

James Desjardins jdesjardins at brocku.ca
Tue Aug 12 13:14:46 PDT 2014

Hi Stuart,

To retrieve the current pointer location try:

get(findobj('tag','eegaxis','parent',gcf), 'currentpoint')

Let me know if this helps.


From: eeglablist-bounces at sccn.ucsd.edu [eeglablist-bounces at sccn.ucsd.edu] on behalf of Stuart Fogel [sfogel at uwo.ca]
Sent: August-06-14 12:15 AM
To: eeglablist at sccn.ucsd.edu
Subject: [Eeglablist] Using ctrlselectcommand in eegplot

Hello eeglab-ers,

I'm trying to gather information about the latency for when the mouse button is ctrl-clicked and ctrl-released from eegplot to be used in some additional code to manipulate the EEG.events structure. According to the eegplot documentation, it seems the best way to get this info is using the ctrlselectcommand option when calling eegplot.

However, I have been running into some trouble figuring out where this information is accessible. I read on the eeglablist that it is in the UserData for the plot, but I have not been able to successfully track it down.

This little bit of code retrieves a whole bunch of info about eegplot, but it seems not what I am looking for (unless it's well hidden). Here's what I have so far:

% Get latency on mouse click and mouse release:
ctrlselectcommand = {'lat1=get(gcbf,''UserData''),' ','lat2=get(gcbf,''UserData'');

% call eegplot with options
eegplot( EEG.data(chaninds,:,:), ...
        'eloc_file',EEG.chanlocs(chaninds), ... ...
        'srate', EEG.srate, ...
        'limits', [EEG.xmin EEG.xmax]*1000 , ...
        'command', command, ...
        'ctrlselectcommand', ctrlselectcommand, ...

Any help on some code snippets or advice on how to retrieve this info would be greatly appreciated!

I also ran into a second issue, which is resolved but only by modifying the code for eegplot.m.  I ran into some trouble getting eegplot to play nicely with the ctrselectcommand option. I slightly modified the code at ~line 1031 of eegplot.m to following, as I could not figure out another way around the issue. I'm not sure if it's a bug, or if I've handled the ctrlselectcommand option clumsily in the first place. In case this is a bug, here's the changes I made to to eegplot.m:

g.commandselect{1} = [ 'if strcmp(get(gcbf, ''SelectionType''),''alt''),' g.ctrlselectcommand{1,1}{1,1} ...
                         ',else '                                           g.selectcommand{1} ',end;' ];
g.commandselect{2} = [ 'if strcmp(get(gcbf, ''SelectionType''),''alt''),' g.ctrlselectcommand{1,1}{1,2} ...
                         ',else '                                           g.selectcommand{2} ',end;' ];
g.commandselect{3} = [ 'if strcmp(get(gcbf, ''SelectionType''),''alt''),' g.ctrlselectcommand{1,1}{1,3} ...
                         ',else '


Stuart Fogel | PhD
Adjunct Professor & Research Scientist
Brain & Mind Institute | Department of Psychology
Western University | London | Ontario | Canada

Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu

More information about the eeglablist mailing list