Be the first to rate this file! 3 Downloads (last 30 days) File Size: 1.81 KB File ID: #25828

Get files

by Joshua Carmichael

 

13 Nov 2009

Retrieves cell array of file names from current directory

| Watch this File

File Information
Description

[Sacs] = getFiles(varargin);
This function returns a cell of file names from the current directory, given any number of inputs of regular expressions. It is analogous to the LINUX 'ls' command, but the output is given to the user as a cell, when using getFiles.m

USAGE
[Sacs] = getFiles('REGEXP1','REGEXP2',...,'REGEXPN');

INPUT
REGEXP1: A character regular expression, such as 'get' or 'mat'.

OUTPUT
Sacs: A cell array containing the file names that match the
          requested character matches.

EXAMPLES
Suppose you have a directory where JPEG images are stored under names that include 'November' somewhere in the title. This returns those file names:

[Sacs] = getFiles('November','.jpg');

Suppose you have directory containing data of the form:
STATION.CHAN.YEAR.DAY.HR.SAC
The following command returns all .SAC files for station 'JAN', channel 'EPZ', Julian day 340, and year 2009:

[Sacs] = getFiles('SAC','JAN',340,2009);

MATLAB release MATLAB 7.9 (2009b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
data import Joshua Carmichael 13 Nov 2009 11:39:16
file reading Joshua Carmichael 13 Nov 2009 11:39:16
regular expression Joshua Carmichael 13 Nov 2009 11:39:16
seismology Joshua Carmichael 13 Nov 2009 11:39:16
sac Joshua Carmichael 13 Nov 2009 11:39:16

Contact us at files@mathworks.com