23.12.2012 Views

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2dir<br />

Purpose Display directory listing<br />

Graphical<br />

Interface<br />

As an alternative to the dir function, use the Current Directory browser. To<br />

open it, select Current Directory from the View menu in the <strong>MATLAB</strong><br />

desktop.<br />

Syntax dir<br />

dir name<br />

files = dir('name')<br />

Description dir lists the files in the current working directory.<br />

dir name lists the specified files. The name argument can be a pathname,<br />

filename, or can include both. You can use absolute and relative pathnames<br />

and wildcards.<br />

files = dir('directory') returns the list of files in the specified directory<br />

(or the current directory, if dirname is not specified) to an m-by-1 structure with<br />

the fields:<br />

name Filename<br />

date Modification date<br />

bytes Number of bytes allocated to the file<br />

isdir 1 if name is a directory; 0 if not<br />

Examples To view the MAT files in your current working directory,<br />

dir *java*.mat<br />

java_array.mat javafrmobj.mat testjava.mat<br />

To view the M-files in the <strong>MATLAB</strong> audio directory, type<br />

dir(fullfile(matlabroot,'toolbox/matlab/audio/*.m'))<br />

Contents.m lin2mu.m sound.m wavread.m<br />

auread.m mu2lin.m soundsc.m wavrecord.m<br />

auwrite.m saxis.m wavplay.m wavwrite.m<br />

To return the list of files to the variable audio_files, type<br />

dir<br />

2-445

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!