帮助中心帮助中心
显示带有行号的文件
dbtype filename
dbtype filename start:end
示例
dbtype filename 可以按照每行前面带有行号的形式显示 filename 的内容。这对使用 dbstop 在程序文件中设置断点很有用。不能使用 dbtype 显示内置函数的源代码。
filename
dbstop
dbtype
dbtype filename start:end 将显示从 start 行号开始到 end 行号结束的这部分文件内容。要显示单行,可以只指定 start 值。
start
end
全部折叠
带行号显示示例文件 buggy.m。
buggy.m
dbtype buggy
1 function z = buggy(x) 2 n = length(x); 3 z = (1:n)./x;
通过显示文件的第一行,查看示例函数 buggy 的输入和输出参量。由于在这种情况下 start 与 end 相同,您可以忽略 end 值。
buggy
dbtype buggy 1
1 function z = buggy(x)
文件名,指定为字符向量或字符串标量。文件名可以采用部分路径,但必须位于搜索路径上的文件夹中或当前文件夹中。否则,请指定完整路径名称。
数据类型: char | string
char
string
起始行号,指定为正整数。
结束行号,指定为正整数。
在 R2006a 之前推出
dbclear | dbstatus | dbstop
dbclear
dbstatus
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office