本文介绍了Matlab strcat函数出现空格问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力做到这一点:

I'm trying to accomplish this:

strcat('red ', 'yellow ', 'white ')

我希望看到红色黄色白色",但是,我在命令输出上看到"redyellowwhite".需要采取什么措施来确保正确地连接空间?预先感谢.

I expected to see "red yellow white", however, I see "redyellowwhite" on the command output. What needs to be done to ensure the spaces are concatenated properly? Thanks in advance.

推荐答案

从matlab帮助页面获取strcat:

From the matlab help page for strcat:

"strcat忽略尾随的ASCII空格字符,并从输出中忽略所有此类字符.ASCII的空格字符为空格,换行符,回车符,制表符,垂直制表符或换页符,所有这些都返回true MATLAB isspace函数的响应.使用串联语法[s1 s2 s3 ...]保留尾随空格.strcat不会忽略作为字符串单元格数组的输入."

"strcat ignores trailing ASCII white space characters and omits all such characters from the output. White space characters in ASCII are space, newline, carriage return, tab, vertical tab, or form-feed characters, all of which return a true response from the MATLAB isspace function. Use the concatenation syntax [s1 s2 s3 ...] to preserve trailing spaces. strcat does not ignore inputs that are cell arrays of strings. "

这篇关于Matlab strcat函数出现空格问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-26 10:03