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

📄 ensuredirexists.html

📁 显著区域检测。求的图像中感兴趣区域的位置
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"                "http://www.w3.org/TR/REC-html40/loose.dtd"><html><head>  <title>Description of ensureDirExists</title>  <meta name="keywords" content="ensureDirExists">  <meta name="description" content="ensureDirExists - makes sure that directory exists.">  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">  <meta name="robots" content="index, follow">  <link type="text/css" rel="stylesheet" href="../m2html.css"></head><body><a name="_top"></a><div><a href="../index.html">Home</a> &gt;  <a href="#">mfiles</a> &gt; ensureDirExists.m</div><!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td><td align="right"><a href="index.html">Index for .\mfiles&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>--><h1>ensureDirExists</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>ensureDirExists - makes sure that directory exists.</strong></div><h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>function ensureDirExists(directory) </strong></div><h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="fragment"><pre class="comment"> ensureDirExists - makes sure that directory exists. ensureDirExists(directory) checks if directory exists    and attempts to create it if it doesn't exist.</pre></div><!-- crossreference --><h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>This function calls:<ul style="list-style-image:url(../matlabicon.gif)"><li><a href="fatal.html" class="code" title="function fatal(message)">fatal</a>	fatal(message) - exits with a fatal error message.</li></ul>This function is called by:<ul style="list-style-image:url(../matlabicon.gif)"><li><a href="initializeGlobal.html" class="code" title="function initializeGlobal(varargin)">initializeGlobal</a>	initializeGlobal - initializes global variables</li></ul><!-- crossreference --><h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="fragment"><pre>0001 <span class="comment">% ensureDirExists - makes sure that directory exists.</span>0002 <span class="comment">%</span>0003 <span class="comment">% ensureDirExists(directory) checks if directory exists</span>0004 <span class="comment">%    and attempts to create it if it doesn't exist.</span>0005   0006 <span class="comment">% This file is part of the SaliencyToolbox - Copyright (C) 2006-2007</span>0007 <span class="comment">% by Dirk B. Walther and the California Institute of Technology.</span>0008 <span class="comment">% See the enclosed LICENSE.TXT document for the license agreement.</span>0009 <span class="comment">% More information about this project is available at:</span>0010 <span class="comment">% http://www.saliencytoolbox.net</span>0011 0012 <a name="_sub0" href="#_subfunctions" class="code">function ensureDirExists(directory)</a>0013 0014 <span class="keyword">global</span> PD;0015 0016 <span class="comment">% does directory alread exist?</span>0017 <span class="keyword">if</span> ~isempty(dir(directory))0018   <span class="keyword">return</span>0019 <span class="keyword">end</span>0020 0021 <span class="comment">% need to create directory - first figure out the base directory</span>0022 slash = find(directory == PD);0023 <span class="keyword">if</span> isempty(slash)0024   basedir = <span class="string">'.'</span>;0025   cdir = directory;0026 <span class="keyword">else</span>0027   <span class="keyword">if</span> (slash(end) == length(directory))0028     <span class="keyword">if</span> (length(slash) == 1)0029       basedir = <span class="string">'.'</span>;0030       cdir = directory;0031     <span class="keyword">else</span>0032       basedir = directory(1:slash(end-1));0033       cdir = directory(slash(end-1)+1:end);0034     <span class="keyword">end</span>0035   <span class="keyword">else</span>0036     basedir = directory(1:slash(end));0037     cdir = directory(slash(end)+1:end);0038   <span class="keyword">end</span>0039 <span class="keyword">end</span>0040 0041 <span class="comment">% does the base directory exist?</span>0042 <span class="keyword">if</span> isempty(dir(basedir))0043   <a href="fatal.html" class="code" title="function fatal(message)">fatal</a>([<span class="string">'Could not create '</span> directory <span class="keyword">...</span>0044   <span class="string">', because the basedir '</span> basedir <span class="string">' does not exist.'</span>]);0045 <span class="keyword">end</span>0046 0047 <span class="comment">% last char of cdir is a slash? Need to remove it</span>0048 <span class="keyword">if</span> (strcmp(cdir(end),PD))0049   cdir = cdir(1:end-1);0050 <span class="keyword">end</span>0051 0052 <span class="comment">% now try making the directory</span>0053 [success, message] = mkdir(basedir,cdir);0054 <span class="keyword">if</span> ~success0055   <a href="fatal.html" class="code" title="function fatal(message)">fatal</a>([<span class="string">'Failed to create '</span> directory <span class="string">' - error message: '</span> message]);0056 <span class="keyword">end</span></pre></div><hr><address>Generated on Fri 07-Sep-2007 14:42:18 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address></body></html>

⌨️ 快捷键说明

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