?? deletewithsemaphores.m
字號:
function deletewithsemaphores(fileList)
%DELETEWITHSEMAPHORES Delete files using semaphors.
% DELETEWITHSEMAPHORES(FILELIST) deletes the files in cell array FILELIST
% using semaphores.
%
% Example:
% fileList = {'test1.txt', 'text2.txt'};
% deletewithsemaphores(fileList);
%
% Markus Buehren
% Last modified 09.01.2009
%
% See also SETFILESEMAPHORE, REMOVEFILESEMAPHORE.
checkWaitTime = 0.1;
nrOfAttempts = 10;
if ischar(fileList)
fileList = {fileList};
end
for fileNr = 1:length(fileList)
sem = setfilesemaphore(fileList{fileNr});
for attemptNr = 1:nrOfAttempts
throwError = 0;
showWarnings = (attemptNr == nrOfAttempts); % only in last attempt
if mbdelete(fileList{fileNr}, showWarnings, throwError)
% deleting was successful
break
else
% wait some time and check again
pause(checkWaitTime);
end
end
removefilesemaphore(sem);
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -