MATLAB Answers

how to assign a callback located in a array of string (in uicontrol) ? ex uicontrol(​'callback'​,array(1))

5 views (last 30 days)
Fabienne Guerville
Fabienne Guerville on 14 Aug 2019
Commented: Geoff Hayes on 14 Aug 2019
my example :
handle.ProcessingConfig = uicontrol(...
'Style' , 'checkbox' ,...
'String' , 'Processing1' ,...
'Tag' , 'processing1' ,...
'Callback' ,listProcessingUnitCallback(1),... how to write this ?
'Units' , 'Normalized' ,...
'Position' ,[0. 0.97 1 0.03],...
'Parent' ,handle.actionsButtonsConfigProc);


Sign in to comment.

Answers (1)

Geoff Hayes
Geoff Hayes on 14 Aug 2019
Fabienne - I think that you may want to create an array of function handles rather than an array of (string) function names. For example,
and then you would extract the callback as
'Callback' ,listProcessingUnitCallback{1},...
using the {} braces rather than the () brackets.


Geoff Hayes
Geoff Hayes on 14 Aug 2019
Fabienne's answer moved here
it's exactly what I want to do but with your syntax I have the same error message : Error while evaluating UIControl Callback.
Geoff Hayes
Geoff Hayes on 14 Aug 2019
Fabienne - please copy and paste the full error message to this question so that we can understand what is going on. It could be that the signature of your functions (in the cell array) do not match the expected signatures of the uicontrol callback.

Sign in to comment.

Sign in to answer this question.