String scalar or character vector must have valid interpreter syntax

26 ビュー (過去 30 日間)
Gookki Jeong
Gookki Jeong 2020 年 7 月 31 日
コメント済み: Walter Roberson 2020 年 7 月 31 日
Rx(1)= "(cos(seta)-0.3 * sin(seta)) * Rx_" ;
Ry(1)= "(0.3*cos(seta) + sin(seta)) * Ry_";
there are my variable and
I wrote the plot title like this
title(Rx(1)+" + "+Ry(1));
but I recieve this error message,' String scalar or character vector must have valid
interpreter syntax' . How can I fix it?

採用された回答

Adam Danz
Adam Danz 2020 年 7 月 31 日
編集済み: Adam Danz 2020 年 7 月 31 日
You probably want something like
title(sprintf('%.2f + %.2f', Rs(1), Ry(1)))
See sprintf for more info.
Update
Set interpretter to 'none',
title(Rx(1)+" + "+Ry(1),'Interpreter','none');
  3 件のコメント
Adam Danz
Adam Danz 2020 年 7 月 31 日
I didn't see that the Rx and Ry values had quotes. In the furture, it would be helpful if you format your code using the [>] button in the question/comment editor.
I've updated my answer with the solution.
Walter Roberson
Walter Roberson 2020 年 7 月 31 日
Interpreter none, or use \_

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by