i have two buttons to search different directories but the second button cant add more variables to the guidata
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
steven Garcia
il 3 Ott 2014
Commentato: Star Strider
il 4 Ott 2014
function pushbutton5_Callback(hObject, eventdata, handles)
symbol=char(92);
dirControl = uigetdir;
dirControl= strcat(dirControl,symbol);
controlfiles=dir([dirControl '*.img']);
for i = 1:numel(controlfiles)
file= strcat(dirControl,controlfiles(i).name,',1');
imcell{1,1} =(file);
end
handles.imcellG1=imcell;
handles.DirectorioG1=dirControl;
guidata(hObject, handles)
function pushbutton6_Callback(hObject, eventdata, handles)
symbol=char(92);
dirControl = uigetdir;
dirControl= strcat(dirControl,symbol);
controlfiles=dir([dirControl '*.img']);
for i = 1:numel(controlfiles)
file= strcat(dirControl,controlfiles(i).name,',1');
imcell{1,1} =(file);
end
handles.imcellG2=imcell;
handles.DirectorioG2=dirControl;
guidata(hObject, handles2)
Risposta accettata
Star Strider
il 3 Ott 2014
I didn’t run your code, but just from observation it seems that if ‘imcell’ has not been created, your ‘controlfiles’ array has zero elements. (Something about either assignment of ‘dirControl’ is probably not correct.) The loop is not iterating.
2 Commenti
Più risposte (1)
Geoff Hayes
il 4 Ott 2014
Steven - in your second callback, look closely at the guidata call
guidata(hObject, handles2)
The second parameter is named handles2 whereas all of your code is updating handles. (I'm surprised that an error isn't thrown because of the invalid variable name.) Just change this line to
guidata(hObject, handles);
and try again.
0 Commenti
Vedere anche
Categorie
Scopri di più su Whos in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!