matlab - Passing arguments to UIcontrol callback function -
i making app track finances , confused how pass string callback function in uicontrol pushbutton object.
for instance:
classdef moneyapp < handle methods (access = public) function app = moneyapp % uicontrol object example app.newsymbolglmc = uicontrol(app.figureglmc,... 'style','pushbutton','position',[300 60 200 20],... 'string','new stock',... 'callback', {@app.newstock,'account name'}); end function newstock(src,eventdata,account) % string, 'account name' end end end
end
i confused how string, 'account name', newstock function. essential part code , think syntax not correct; more examples of code can provided if needed. appreciated!
since newstock
method of class, first input must object itself. because of need 4 input arguments in function definition: instance, source , event data (the default inputs), , account name.
function newstock(obj, src, eventdata, account)
as side note, capitalization of constructor (moneyapp
) must match capitalization of class (moneyapp
) treated constructor.
Comments
Post a Comment