This is machine translation

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


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 numberstart and ending at line number end. To display a single line, you can specify only the start value.


collapse all

View File with Line Numbers

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 Function Arguments

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

filename — File namecharacter vector

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

start — Starting line numberpositive integer

Starting line number, specified as a positive integer.

end — Ending line numberpositive integer

Ending line number, specified as a positive integer.

See Also

| |

Introduced before R2006a

Was this topic helpful?