tempdir2.m
来自「This contribution provides functions for」· M 代码 · 共 37 行
M
37 行
function tempDir2 = tempdir2%TEMPDIR2 Return temporary directory.% DIR = TEMPDIR2 returns as a temporary directory the directory% <TEMPDIR>/<USERNAME>@<HOSTNAME>/MATLAB. This directory is user- and% host-specific and thus better suited in networks/clusters than the% temporary directory returned by Matlab function TEMPDIR.%% Markus Buehren% Last modified 20.04.2008%% See also TEMPDIR, GETUSERNAME, GETHOSTNAME.persistent tempDir2Persistentif isempty(tempDir2Persistent) % build directory string tempDir2 = tempdir; tempDir2 = fullfile(tempDir2, [getusername '@' gethostname], 'MATLAB'); % if directory is not existing, try to create it if ~exist(tempDir2, 'dir') try mkdir(tempDir2); catch error('Unable to create directory %s.', tempDir2); end end % save string for next function call tempDir2Persistent = tempDir2;else % return string computed before tempDir2 = tempDir2Persistent;end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?