I would like to create a gui which reads all the files (the number of files changes for each case (ii)) in a folder, then the number of files (ii) creates ii checkboxes. If a checkbox is activated, the matching file is displayed on a graph.
My issue is to create the callback in the loop for:
function main
N=500;
M=300;
handles.fig=figure('Units', 'Pixels','Position',[100 100 N M]);
handles.axes=axes('Units', 'Pixels','Position',[25 25 N-200 M-50]);
for ii=1:4; %input exemple
handles.check{ii}=uicontrol('style','checkbox','string','Display','position',[N-150-ii*20 M/2 150 50]);
set(handles.check{ii},'Callback',{@checkbox_callback(ii), handles});
end
end
for ii=1:4;
function checkbox_callback(ii)(gcf, event_data, handles)
val=get(handles.check(ii),'Value');
if val
x=1:10;
y=1:10;
plot(x,y)
else
grid off;
end
end
end
Aucun commentaire:
Enregistrer un commentaire