MATLAB Runtime Server    
dirlist

List all files in directories on the current path

Syntax

Description

[w,wc,wp] = dirlist returns three structure arrays containing information about all of the directories on the path and in the current directory. Each structure array (w, wc, and wp) has the same fields as the structure array produced by the MATLAB what command.

Field
Description
path
The directory path (a string)
m
The names of the M-files in the directory (a cell array of strings)
mat
The names of the MAT-files in the directory (a cell array of strings)
mex
The names of the MEX-files in the directory (a cell array of strings)
mdl
The names of the Simulink model files in the directory (a cell array of strings)
p
The names of the P-files in the directory (a cell array of strings)
classes
The names of the class directories in the directory (a cell array of strings)

w provides this information for every standard directory on the path and in the current directory. wc provides this information for every class directory on the path and in the current directory. wp provides this information for every private directory on the path and in the current directory.

The length of w is the same as the number of standard directories, the length of wc is the same as the number of class directories, and the length of wp is the same as the number of private directories.

Example

To see the dirlist information for private directories on the path, look at wp. The output shown below is for a typical MATLAB installation.

This means that there are 14 private directories on the path and in the current directory. To see what the third one is, type

The directory is toolbox\matlab\uitools\private, and it contains 12 M-files, 2 MAT-files, 1 MEX-file, and 12 P-files. There are no Simulink model files or class directories in the uitools\private directory. To see the MAT-files in uitools\private, look at wp(3).mat.

See Also

depdir, depfun


  depfun inmem