⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deletewithsemaphores.m

📁 This contribution provides functions for finding an optimum parameter set using the evolutionary alg
💻 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 21.12.2008
%
%		See also SETFILESEMAPHORE, REMOVEFILESEMAPHORE.

checkWaitTime = 0.1;

if ischar(fileList)
	fileList = {fileList};
end

for fileNr = 1:length(fileList)
	sem = setfilesemaphore(fileList{fileNr});
	for attemptNr = 1:10
		try
			if existfile(fileList{fileNr})
				delete(fileList{fileNr}); %% file access %%
			end
			break
		catch
			pause(checkWaitTime);
		end
	end
	removefilesemaphore(sem);
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -