summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/toolbox/toolbox_basic/stella/getfnames.m
diff options
context:
space:
mode:
authorleochanj105 <leochanj@live.unc.edu>2020-10-19 23:09:30 -0400
committerleochanj105 <leochanj@live.unc.edu>2020-10-20 02:40:39 -0400
commitf618466c25d43f3bae9e40920273bf77de1e1149 (patch)
tree460e739e2165b8a9c37a9c7ab1b60f5874903543 /SD-VBS/common/toolbox/toolbox_basic/stella/getfnames.m
parent47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff)
initial sd-vbs
initial sd-vbs add sd-vbs sd-vbs
Diffstat (limited to 'SD-VBS/common/toolbox/toolbox_basic/stella/getfnames.m')
-rwxr-xr-xSD-VBS/common/toolbox/toolbox_basic/stella/getfnames.m47
1 files changed, 47 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/toolbox_basic/stella/getfnames.m b/SD-VBS/common/toolbox/toolbox_basic/stella/getfnames.m
new file mode 100755
index 0000000..4990451
--- /dev/null
+++ b/SD-VBS/common/toolbox/toolbox_basic/stella/getfnames.m
@@ -0,0 +1,47 @@
1% function [fn,dn] = getfnames(direc,opt)
2% Input:
3% direc = directory
4% opt = wildcat
5% Output:
6% fn = a cell with all filenames under direc and with opt
7% dn = a cell with all directory names under direc and with opt
8% For example, getfnames('19990910','*.jpg');
9% Set IS_PC according to your platform in globalenvar.m
10
11% Stella X. Yu, 2000.
12
13function [fn,dn] = getfnames(direc,opt)
14
15if (nargin<1 | isempty(direc)),
16 direc = '.';
17end
18
19if nargin<2 | isempty(opt),
20 opt = [];
21end
22
23fn = {};
24dn = {};
25
26cur_dir = pwd;
27cd(direc);
28s = dir(opt);
29if isempty(s),
30 disp('getfnames: no data');
31 return;
32end
33
34n = length(s);
35i = 1;
36j = 1;
37for k=1:n,
38 if s(k).isdir,
39 dn{j,1} = s(k).name;
40 j = j + 1;
41 else
42 fn{i,1} = s(k).name;
43 i = i + 1;
44 end
45end
46 cd(cur_dir)
47%[fn{1:n,1}]=deal(s.name);