Main Content

dbtype

Display file with line numbers

Description

dbtype file displays the contents of file with line numbers preceding each line. This is helpful when setting breakpoints in a program file with dbstop. You cannot use dbtype to display the source code of built-in functions.

example

dbtype file start:end displays the portion of the file starting at line number start and ending at line number end. To display a single line, you can specify only the start value.

example

Examples

collapse all

Display the example file buggy.m with line numbers preceding each line.

Create a file, buggy.m, that contains these statements.

function z = buggy(x)
n = length(x);
z = (1:n)/x';
dbtype buggy
1     function z = buggy(x)
2     n = length(x);
3     z = (1:n)/x';

View the input and output arguments for an example function, buggy, by displaying the first line of the file. Since start and end are the same in this case, you can omit the end value.

Create a file, buggy.m, that contains these statements.

function z = buggy(x)
n = length(x);
z = (1:n)/x';
dbtype buggy 1
1     function z = buggy(x)

Input Arguments

collapse all

File name, specified as a character vector or string scalar. The file name can be a partial path, but it must be in a folder on the search path or in the current folder. Otherwise, specify the full path name.

Data Types: char | string

Starting line number, specified as a positive integer.

Ending line number, specified as a positive integer.

Version History

Introduced before R2006a

See Also

| |