MATLAB 帮助中心
续行
...
省略号符号 (...) 表示当前命令延续到下一行。如果行末尾之前存在三个或更多个句点,则 MATLAB® 会忽略该行的其余部分而直接延续到下一行。此行为实际上相当于将当前行上三个句点之后的任何内容作为注释。
MATLAB 将省略号解释为空格字符。因此,多行命令与将省略号替换为空格字符的单行命令等效。
示例
全部展开
将函数调用延续到下一行。
vname = "Var1"; value = 10; sprintf(["The current value " + ... "of %s is %d"],vname,value)
ans = "The current value of Var1 is 10"
在多行上分解字符向量并将这些行串联在一起。
S = ['If three or more periods occur before the ' ... 'end of a line, then the rest of that line is ' ... 'ignored and MATLAB continues to the next line'];
要将多行命令中的一行注释掉,请在该行的开头使用 ... 以确保命令保持完整。如果您使用 % 将某一行注释掉,则命令会产生错误。
%
y = 1 + ... 2 + ... % 3 + ... 4
但是,以下代码可正常运行,因为第三行不会在命令中产生间断。
y = 1 + ... 2 + ... ... 3 + 4
y = 7
在 R2006a 之前推出
.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处