Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matlab 2014b/2015: handle.listener error #16

Closed
jasonarita opened this issue Apr 1, 2015 · 3 comments
Closed

Matlab 2014b/2015: handle.listener error #16

jasonarita opened this issue Apr 1, 2015 · 3 comments
Assignees
Labels

Comments

@jasonarita
Copy link
Contributor

Problem

In MATLAB 2014b and above, the new graphics system is based on MATLAB® objects, which do not support the use of HANDLE.LISTENER to create event listeners. To create listeners for graphics objects, use the function ADDLISTENER.


Originally from: Matthew Walenski

Matthew Walenski matthew.walenski@northwestern.edu via ucdavis.edu
Apr 1
to erplab

Hi,

I am having trouble plotting averaged ERPS – when I select ERPLAB -> Plot ERP -> Plot ERP waveforms
I end up with only a single electrode, which is not labelled and there is no legend.

I get the following error message below.

I found a bug report for this issue (it appears to be the same issue) in EEGLAB, but saw no resolution there, only a reference to this mailing list.
I was unable to find/search the list archive at UC Davis, so I would appreciate any help or insight!

Best,
matt

---------error message----------
No constructor 'handle.listener' with matching signature found.

Error in neozeroaxes>plistener (line 154)
hl = handle.listener(hC, hSrc, psetact, {func, axesin});

Error in neozeroaxes (line 144)
plistener(axesin,'XLim',@xylim)

Error in ploterps (line 574)
                        neozeroaxes(1, fsaxtick, BCKGCOLOR)

Error in pop_ploterps (line 684)
ploterps(ERP, binArray, chanArray,  qpstyle, qMgfp, qBlc, qxscale, qyscale, qLineWidth, qisiy,
qFontSizeChan, qFontSizeLeg, qFontSizeTicks, qerrorstd,...

Error in pop_ploterps (line 301)
        [ERP, erpcom] = pop_ploterps(ERP, binArray, chanArray, 'AutoYlim', rAutoYlim, 'BinNum',
        rBinNum, 'Blc', blcorr,...
Error while evaluating Menu Callback
@jasonarita jasonarita added the bug label Apr 1, 2015
@jasonarita jasonarita self-assigned this Apr 1, 2015
@jasonarita
Copy link
Contributor Author

Suggestion

Replace all HANDLE.LISTENER() calls with ADDLISTENER(). For example:

Neozeroxes.m (Line 154)

function [] = plistener(axesin,prp,func)
% Sets the properties listeners.  From proplistener by Yair Altman.
psetact = 'PostSet';
hC = handle(axesin);
% hSrc = hC.findprop(prp);
% hl = handle.listener(hC, hSrc, psetact, {func, axesin});
hl = addlistener(hC, prp, psetact, func);

Matlab's documentation

lh = addlistener(Hsource,property,EventName,callback)

Hsource — Event source
handle array
Event source is the object that is source of the event, or an array of source objects, specified as a handle array.

EventName — Name of event
character array
Name of event that is triggered on the source objects, specified as a case-sensitive, quoted string. For property events, the event name is one of the four predefined property events.

property — Name of property
string
Name of the property whose property event triggers your listener, specified as one of these values:

A scalar meta.property object
An array or a cell array of meta.property objects
A string or a cell array of strings, where each string is the name of a property defined for the objects in Hsource
You can listen to property events on dynamic properties only If Hsource is scalar. If Hsource is non-scalar, then the properties must belong to the class of Hsource and can not include dynamic properties (which are not part of the class definition).
The class defining the source property must set the GetObservable and SetObservable property attributes to enable you to listen to the property events.

callback — Listener callback
function handle
Listener callback specified as a function handle

@jasonarita
Copy link
Contributor Author

We need to apply this fix to the following 3 functions that use handle.listener function:

  1. functions/neozeroaxes.m (line 154)
  2. functions/neoaxescenter.m (line 183)
  3. functions/axescenter.m (line 188)

jasonarita pushed a commit that referenced this issue Apr 29, 2015
HANDLE.LISTENER is no longer a valid function call when creating an
event listener. This is due to Matlab’s new graphics system (Matlab
2014b & later). And so the function call is now replaced with the
ADDLISTENER function call.
@inheniero inheniero assigned inheniero and unassigned jasonarita May 8, 2015
@jasonarita
Copy link
Contributor Author

@inheniero A quick search through our code repository shows that we don't call the functions axescenter.m and neoaxescenter.m anymore in our working code, so how 'bout we move those 2 functions to the deprecated folder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants