This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Display contents of file


type filename


type('filename') displays the contents of the specified file in the MATLAB® Command Window. filename is a character vector containing a name of a file which can include a path and a file extension. Use the full path for filename, or use a MATLAB relative partial path.

The type function makes it convenient to list the contents of files on the screen and supports files with the following extensions.

File ExtensionDescription
.mlxMATLAB Live Script — Interactive document created using MATLAB Live Editor.
.mlappMATLAB App File — App created using MATLAB App Designer.
.mMATLAB Code — A MATLAB script, function, or class.

If you do not specify a file extension and no extension-less file exists, then type assumes that the extension is .mlx, .mlapp, or .m. For instance, if a file myscript.m exists, then the type myscript command displays the contents of the file.

If multiple files exist with the same name but different extensions, then include the extension with filename. For instance, if foo.mlx, foo.mlapp, and foo.m are all in one folder. Then use the command type('foo.m') to display the foo.m file.

Use type with more on to see the listing one screen at a time.

type filename is the command form of the syntax.


type('') lists the contents of the file

type foo lists the contents of the file foo. If foo does not exist, but foo.mlx does, then type foo lists the contents of the file foo.mlx.

See Also

| | | | | | |

Introduced before R2006a

Was this topic helpful?