フィルターのクリア

i have two buttons to search different directories but the second button cant add more variables to the guidata

2 ビュー (過去 30 日間)
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)

採用された回答

Star Strider
Star Strider 2014 年 10 月 3 日
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 件のコメント
steven Garcia
steven Garcia 2014 年 10 月 4 日
編集済み: steven Garcia 2014 年 10 月 4 日
yes you right my files in the second directory are wrong

サインインしてコメントする。

その他の回答 (1 件)

Geoff Hayes
Geoff Hayes 2014 年 10 月 4 日
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.

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by