Main Content


Display file with line numbers



dbtype filename displays the contents of filename 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.


dbtype filename 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.


collapse all

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

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.

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

| |