i want to add a waitbar

3 ビュー (過去 30 日間)
Ishak Oussama
Ishak Oussama 2019 年 2 月 20 日
回答済み: Kojiro Saito 2019 年 2 月 25 日
hi i want to add a waitbar to my program,which displays the folder name of each iteration
HERE'S MY CODE
parentDir={'C:\Users\HP\Documents\Matlab\FOLDER AA',
'C:\Users\HP\Documents\Matlab\FOLDER BB',
'C:\Users\HP\Documents\Matlab\FOLDER CC',
'C:\Users\HP\Documents\Matlab\FOLDER DD',
'C:\Users\HP\Documents\Matlab\FOLDER EE',
'C:\Users\HP\Documents\Matlab\FOLDER FF',
'C:\Users\HP\Documents\Matlab\FOLDER GG',
'C:\Users\HP\Documents\Matlab\FOLDER HH',
'C:\Users\HP\Documents\Matlab\FOLDER II',
'C:\Users\HP\Documents\Matlab\FOLDER KK',
'C:\Users\HP\Documents\Matlab\FOLDER LL',
'C:\Users\HP\Documents\Matlab\FOLDER MM',
'C:\Users\HP\Documents\Matlab\FOLDER NN',
'C:\Users\HP\Documents\Matlab\FOLDER OO',
'C:\Users\HP\Documents\Matlab\FOLDER PP',
'C:\Users\HP\Documents\Matlab\FOLDER QQ',
'C:\Users\HP\Documents\Matlab\FOLDER RR',
'C:\Users\HP\Documents\Matlab\FOLDER SS',
'C:\Users\HP\Documents\Matlab\FOLDER TT',
'C:\Users\HP\Documents\Matlab\FOLDER UU'}
for j = 1:length(parentDir);
matchList{j} = [matchList{j}; names(endIdx == strLen & endIdx > 0)'];
end

採用された回答

Kojiro Saito
Kojiro Saito 2019 年 2 月 25 日
This example (in R2014a) might be useful and here is a sample code. You need to create waitbar before for loop and update inside the loop.
% Create initial waitbar
f = waitbar(0, '', 'CreateCancelBtn','setappdata(gcbf,''canceling'',1)');
for j = 1:length(parentDir)
matchList{j} = [matchList{j}; names(endIdx == strLen & endIdx > 0)'];
% In order to avoid "invalid interpreter syntax" warning
folderNameWithValid = strrep(parentDir{j}, "\", "\\");
% Update waitbar and message
waitbar(j/length(parentDir), f, sprintf('Reading %s', folderNameWithValid))
end
% Delete waitbar
delete(f)

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by