Filter löschen
Filter löschen

Addlistener error: Undefined function for input arguments of type 'matlab.ui.Figure'.

3 Ansichten (letzte 30 Tage)
I am using addlistener in my openingFcn like this
handles.viewCAM_handles.listener = addlistener(viewCAM_handles.slider_master,'Value', 'PostSet',@(eventdata,viewCAM_handles)slider_master_continuousCallback(hObject,eventdata,handles));
But i get the error: Undefined function 'slider_master_continuousCallback' for input arguments of type 'matlab.ui.Figure'. Why can't I use a figure as input argument for my callback? What should I use instead, I tried with hObject but it gave me the same error.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 29 Jun. 2016
I do not know why you are getting that error, but you need to change your code:
handles.viewCAM_handles.listener = addlistener(viewCAM_handles.slider_master,'Value', 'PostSet', @(hObject, eventdata) slider_master_continuousCallback(hObject, eventdata, handles));
and keep in mind that the handles that will be passed will not include handles.viewCAM_handles.listener because it will be passed by value with the value as of the line before (because the right hand side is evaluated before the left)
  5 Kommentare
Joakim Magnusson
Joakim Magnusson am 29 Jun. 2016
The problem was that i tried to call a function inside a m-file from another m-file...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Entering Commands finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by