Revision 495
(checked in by cbc, 12 years ago)
|
Initial import of Stark code.
|
Line | |
---|
1 |
|
---|
2 |
function [files,Dout]=wilddir(datadir,string); |
---|
3 |
|
---|
4 |
% |
---|
5 |
% WILDDIR.M - creates a list of files padded with trailing blanks |
---|
6 |
% (remove with deblank.m or blank.m) of all files in directory DATADIR |
---|
7 |
% ending with STRING |
---|
8 |
% |
---|
9 |
% Catherine R. Edwards |
---|
10 |
% Last modified: 2 Aug 2000 |
---|
11 |
% |
---|
12 |
|
---|
13 |
if nargin==1 |
---|
14 |
string=datadir; |
---|
15 |
datadir=pwd; |
---|
16 |
end |
---|
17 |
|
---|
18 |
D=dir(datadir); N=length(D)-2; |
---|
19 |
Dout=D; |
---|
20 |
|
---|
21 |
files=[]; match=[]; |
---|
22 |
for i=1:N |
---|
23 |
file=getfield(D(i+2,1),'name'); |
---|
24 |
l=length(file); lstr=length(string); |
---|
25 |
if(l>=lstr) |
---|
26 |
if(strcmp(file(l-lstr+1:l),string)) |
---|
27 |
files=strvcat(files,file); |
---|
28 |
match=[match i+2]; |
---|
29 |
end |
---|
30 |
end |
---|
31 |
end |
---|
32 |
Dout=D(match); |
---|