matlab single quote problem
3 次查看(过去 30 天)
显示 更早的评论
how should I output this sentence in single quote instead of double quote? Because change the double quote to single quote directly is not work ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/304739/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/304739/image.png)
0 个评论
采纳的回答
Brent Kostich
2020-5-28
You need to use brackets when creating a multi-part sentence like that, which is equal to horzcat. Also, you need to use character segments, not strings.
pi = ['The approximation on ', num2str(n), ' terms is ', num2str(round(pi*4, 4))];
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numeric Types 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!