source: aedes_check_file_exist.m

Last change on this file was 80, checked in by tjniskan, 9 years ago
  • Changed the historical "an2_" prefix to "aedes_" in all files. NOTE:

Any script or function relying to Aedes functions will be broken
because of this. Just do a search/replace from "an2_" to "aedes_" in
your files and all should be well...

  • Changed the name of an2_readtab.m to a more informative

aedes_readphasetable.m

File size: 1.4 KB
Line 
1function ind = aedes_check_file_exist(fnames,fpath)
2% AEDES_CHECK_FILE_EXIST - Check if files exist in a specified directory
3%   
4%
5% Synopsis:
6%
7% Description:
8%
9% Examples:
10%
11% See also:
12%
13
14% This function is a part of Aedes 2.0 - A graphical tool for analyzing
15% medical images
16%
17% Copyright (C) 2006 Juha-Pekka Niskanen <Juha-Pekka.Niskanen@uku.fi>
18%
19% Department of Physics, Department of Neurobiology
20% University of Kuopio, FINLAND
21%
22% This program may be used under the terms of the GNU General Public
23% License version 2.0 as published by the Free Software Foundation
24% and appearing in the file LICENSE.TXT included in the packaging of
25% this program.
26%
27% This program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28% WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29
30
31ind=[];
32
33%% Check input arguments
34if nargin<2
35  error('Too few input arguments!');
36elseif nargin>2
37  error('Too many input erguments!')
38end
39
40if ~iscell(fnames)
41  fnames={fnames};
42end
43
44%% Get files in the specified directory
45if ~isdir(fpath)
46  error('Directory "%s" does not exist!',fpath)
47end
48d=dir(fpath);
49dir_files={d(~[d(:).isdir]).name};
50
51if isempty(dir_files)
52  ind=false(size(fnames));
53  return
54end
55
56%% Check if any of the files exist
57if ~isunix % Check file names, in windows ignore case
58  ind=ismember(lower(fnames),lower(dir_files));
59else
60  ind=ismember(fnames,dir_files);
61end
62
63return
64% - EOF -
Note: See TracBrowser for help on using the repository browser.

Powered by Trac 1.0.9.Copyright © Juha-Pekka Niskanen 2008