前言: Matlab中有时遇到需要输出较长的一句话,为了显示方便,需要进行分行显示,下面的方法可以采用。 分行显示代码 nextmsg = 'to be continued from last message'; outputstring = sprintf(['The message to be displayed is too long \n' ... '"%s"'],nextmsg); title = 'Output string'; h=msgbox(outputstring,title); 以上代码执行后的效果见下图所示: