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

조회 수: 1 (최근 30일)
my example :
listProcessingUnitCallback={...
'signalstatistics_callback','signalFFT_callback','inverseFFT_callback','harmonic_callback','PSD_callback',...
'spectralCoherence_callback','angle_callback','orderSpectrum_callback','invorderSpectrum_callback',...
'synchronousaverage_callback','synchronousaveragespectrum_callback','residual_callback','residualspectrum_callback',...
'envelope_callback','envelopespectrum_callback','miscProcessing_callback','Spectrogram_callback',...
'Cyclostatio_callback','FIRFilter_callback','TOPdetect_callback'};
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);

답변 (1개)

Geoff Hayes
Geoff Hayes 2019년 8월 14일
Fabienne - I think that you may want to create an array of function handles rather than an array of (string) function names. For example,
listProcessingUnitCallback={...
@signalstatistics_callback,@signalFFT_callback};
and then you would extract the callback as
'Callback' ,listProcessingUnitCallback{1},...
using the {} braces rather than the () brackets.
  댓글 수: 2
Geoff Hayes
Geoff Hayes 2019년 8월 14일
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 2019년 8월 14일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by