summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/toolbox/toolbox_basic/stella/getfnames.m
diff options
context:
space:
mode:
authorLeo Chan <leochanj@live.unc.edu>2020-10-22 01:53:21 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2020-10-22 01:56:35 -0400
commitd17b33131c14864bd1eae275f49a3f148e21cf29 (patch)
tree0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/common/toolbox/toolbox_basic/stella/getfnames.m
parent601ed25a4c5b66cb75315832c15613a727db2c26 (diff)
Squashed commit of the sb-vbs branch.
Includes the SD-VBS benchmarks modified to: - Use libextra to loop as realtime jobs - Preallocate memory before starting their main computation - Accept input via stdin instead of via argc Does not include the SD-VBS matlab code. Fixes libextra execution in LITMUS^RT.
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);