Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String MATLAB字符串中的换行符_String_Matlab_Line Breaks - Fatal编程技术网

String MATLAB字符串中的换行符

String MATLAB字符串中的换行符,string,matlab,line-breaks,String,Matlab,Line Breaks,我正在编写一个代码,其中我要求用户输入。然而,通知用户这一点的字符串有点长,当我使用代码时,它都被写在命令窗口的一行上。我想把它分为多行。我的代码是: n = input(['The matrix is diagonally dominant. Please choose which method you wish to'... ' use: 1 (Gaussian elimination), 2 (Jacobi iterations),'... ' 3 (Ga

我正在编写一个代码,其中我要求用户输入。然而,通知用户这一点的字符串有点长,当我使用代码时,它都被写在命令窗口的一行上。我想把它分为多行。我的代码是:

n = input(['The matrix is diagonally dominant.  Please choose which method you wish to'...
        ' use: 1 (Gaussian elimination), 2 (Jacobi iterations),'...
        ' 3 (Gauss-Seidel iterations).  If you enter any other number'...
        ' Gaussian elimination will automatically be used: ']);

如果更好的话,我希望将其显示在4行上,如代码中所示。如何完成此操作?

使用
\n
作为中断字符,例如:

n = input(sprintf('blablabla\nblablabla\n'))
使用sprinf和\n(换行符)


令人惊叹的!非常感谢您的快速回复。
n = input(sprintf(['The matrix is diagonally dominant.  Please choose which method you wish to\n'...
    ' use: 1 (Gaussian elimination), 2 (Jacobi iterations),\n'...
    ' 3 (Gauss-Seidel iterations).  If you enter any other number\n'...
    ' Gaussian elimination will automatically be used: ']));