dir
List files in a directory.
Syntax
Section titled “Syntax”dirdir(name)files = dir(name)Description
Section titled “Description”Lists the files and subdirectories in name (or the current directory if no argument). Wildcards (*, ?) are supported.
With an output assignment, returns a struct array — one element per matched file — with fields name, folder, date, bytes, isdir, datenum. Without output assignment, prints the listing.
Examples
Section titled “Examples”dir % list current directorydir('*.csv') % list all CSV filesfiles = dir('data/'); % capture as struct array