type

Displays the contents of a text file in the command window.

Category: Data Import and Analysis > Data Import and Export

Syntax

type filename

Prints the file filename (command form).

type('filename')

Function form, useful when the name is in a variable.

Description

type reads the file as text and shows it exactly as stored, line by line, with a blank line before and after. It is the quickest way to check what writematrix, writelines or writestruct actually produced.

It is meant for text. Pointing it at a binary file prints unreadable characters. If the file cannot be found, an error is raised.

Input arguments

filename
Name or path of the file, with its extension when it has one.

Example

Show a file just written

writematrix([1 2; 3 4], 'type_demo.csv');
type type_demo.csv
Output

1,2
3,4

See also

fileread disp writematrix readlines