Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 Matlab 中为等效 Java 代码的字符串添加换行符?
String line; line += "\n";
从下面的链接
str = sprintf('test \n test') or str = ['test ' char(10) ' 'test']
“换行符”取决于您使用的操作系统......最好的解决方案是
line = sprintf('%s\n', line);
这将强制 Matlab 使用操作系统的“正确”回车。