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 如何将MException转换为一行字符串_String_Matlab_Exception - Fatal编程技术网

String 如何将MException转换为一行字符串

String 如何将MException转换为一行字符串,string,matlab,exception,String,Matlab,Exception,我试图将MException转换为一行字符串,然后将其附加到日志文件中,但是由于某些原因,我无法删除错误消息中的换行符 try error("rand Error") catch err a = string(getReport(err, 'extended','hyperlinks', 'off')) end 换行符似乎不是“\n”,而是”↵' 我试着用strep(a,'↵','') 并删除(a,'↵') 但两者都不起作用。'↵'是回车符和换行符的组合;您可以使用strep

我试图将MException转换为一行字符串,然后将其附加到日志文件中,但是由于某些原因,我无法删除错误消息中的换行符

try 
    error("rand Error")
catch err
    a = string(getReport(err, 'extended','hyperlinks', 'off'))
end

换行符似乎不是“\n”,而是”↵' 我试着用strep(a,'↵','') 并删除(a,'↵') 但两者都不起作用。

'↵'
是回车符和换行符的组合;您可以使用
strep(a,“\r\n”,”)
erase(a,“\r\n”)
删除它