[Eeglablist] Using ctrlselectcommand in eegplot

Stuart Fogel sfogel at uwo.ca
Tue Aug 5 21:15:28 PDT 2014


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
chaninds=[1:length(EEG.chanlocs)];
eegplot( EEG.data(chaninds,:,:), ...
	'eloc_file',EEG.chanlocs(chaninds), ... ...
	'srate', EEG.srate, ...
        'limits', [EEG.xmin EEG.xmax]*1000 , ...
        'command', command, ...
        'ctrlselectcommand', ctrlselectcommand, ...
        'events',EEG.event); 

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 '  

Thanks,
Stuart

==
Stuart Fogel | PhD
Adjunct Professor & Research Scientist
Brain & Mind Institute | Department of Psychology
Western University | London | Ontario | Canada
http://www.BMIsleeplab.uwo.ca
==




More information about the eeglablist mailing list