Revision 495
(checked in by cbc, 12 years ago)
|
Initial import of Stark code.
|
Line | |
---|
1 |
|
---|
2 |
function [matchfiles,nomatchfiles]=wilddirc(datadir,string); |
---|
3 |
|
---|
4 |
% |
---|
5 |
% WILDDIRC.M - creates a cell of files |
---|
6 |
% of all files in directory DATADIR containing STRING |
---|
7 |
% |
---|
8 |
% Catherine R. Edwards |
---|
9 |
% Last modified: 3 Apr 2006 |
---|
10 |
% |
---|
11 |
|
---|
12 |
if nargin==1 |
---|
13 |
string=datadir; |
---|
14 |
datadir=pwd; |
---|
15 |
end |
---|
16 |
|
---|
17 |
if(~exist(datadir,'dir')); error([datadir,' is not a directory']); end |
---|
18 |
|
---|
19 |
D=dirc(datadir,'f'); N=length(D); |
---|
20 |
|
---|
21 |
matches=[]; |
---|
22 |
for i=1:N |
---|
23 |
file=char(D(i,1)); |
---|
24 |
matches(i)=~isempty(strfind(file,string)); |
---|
25 |
end |
---|
26 |
|
---|
27 |
matches=find(matches); |
---|
28 |
|
---|
29 |
if(sum(matches)==0); |
---|
30 |
matchfiles=[];nomatchfiles=D(:,1); |
---|
31 |
else; matchfiles=D(matches,1); nomatchfiles=setdiff(D(:,1),matchfiles); |
---|
32 |
end |
---|