FUNCTION REFERENCE

ls

List file names.

List file names.

Syntax

names = ls

Syntax

names = ls(folderOrPattern)

Returns a padded character matrix, one sorted name per row. With no output, prints the names. Uses the same wildcard and scan bounds as dir.

Example

d=tempname(pwd); mkdir(d); names=ls(d); rmdir(d); size(names)   % [2 2]

Differences from MATLAB: Always returns the Windows-style character matrix, including dot and dot-dot for directories.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.