i want to add a waitbar
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Ishak Oussama
il 20 Feb 2019
Risposto: Kojiro Saito
il 25 Feb 2019
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
0 Commenti
Risposta accettata
Kojiro Saito
il 25 Feb 2019
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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Dialog Boxes in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!