Writing strings on multiple lines

25 ビュー (過去 30 日間)
Tin Nguyen
Tin Nguyen 2015 年 8 月 29 日
編集済み: Stephen23 2015 年 8 月 31 日
Hi, I am trying to draw a graph with the following code:
figure
plot(x,dfdx4,'k-',x,dfdx5,'b-',x,dfdx6,'g-', x,fx4, 'r--','LineWidth',2);
axis([-1 1 -7 14])
xlabel('-1 <= x <= 1', 'FontSize',12,'fontweight','bold')
ylabel('dfdx4, dfdx5, dfdx6 & fx4', 'FontSize',12,'fontweight','bold')
title('Comparsion of Exact and Approximate derivatives with artifical' ...
'normally-distrubuted artifical noise')
My title is pretty long and I want to put it on a new line so it'll. I did a bit googling and it told me to do it like that but when I try to run it it gives me an error. Is there another way I'll be able to do this or am I doing it wrong?
  1 件のコメント
Stephen23
Stephen23 2015 年 8 月 29 日
編集済み: Stephen23 2015 年 8 月 31 日
What exactly is the problem?:
  1. you want to put the text string that defines the title onto two lines, or
  2. you want to display the title on two lines?

サインインしてコメントする。

回答 (2 件)

Star Strider
Star Strider 2015 年 8 月 29 日
Another option is using sprintf and a linefeed (\n):
title(sprintf('Comparsion of Exact and Approximate derivatives with artifical\nnormally-distrubuted artifical noise'))

Walter Roberson
Walter Roberson 2015 年 8 月 29 日
編集済み: Walter Roberson 2015 年 8 月 29 日
['12345', ...
'678`]

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by