フィルターのクリア

How can I write an accent in a French sentence on a figure (title, xlable,ylabel)

21 ビュー (過去 30 日間)
Let say that I want to label the x-axis or the y-axis or added a specified title to a figure, and the statement contains an accent like ( Numéro d'iteration), I found an answer for this problem https://www.mathworks.com/matlabcentral/answers/25698-accent-as-a-character-in-a-string, but it is not working because of the sentence looks like: " Numéro d''iteration".
Any ideas how can I fix this problem?
  1 件のコメント
Stephen23
Stephen23 2018 年 6 月 14 日
編集済み: Stephen23 2018 年 6 月 14 日
"I found an answer for this problem "
You found an answer to a different problem: how to add an apostrophe to a char vector. Your question indicates that you are using a string, not a char vector, so that linked answer is irrelevant to your problem.

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

採用された回答

Stephen23
Stephen23 2018 年 6 月 14 日
編集済み: Stephen23 2018 年 6 月 14 日
Note that strings and char vectors are different things, and so the apostrophe needs to be defined differently:
str = "d'iteration"
chr = 'd''iteration'

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 6 月 14 日
If you are using R2014a or earlier, getting non-ASCII characters can be difficult or tricky.
If you are using R2014b or later, then if you are using 'interpreter', 'tex' or 'interpreter', 'none', then you can directly include the characters such as é in the string. For portability because English MATLAB versions are often not UTF safe, you might want to construct the string using appropriate char() to insert the characters.
If you are using 'interpreter', 'latex' then you cannot include é and similar characters directly by using their character codes, and you have to include latex encodings of them. https://tex.stackexchange.com/questions/8857/how-to-type-special-accented-letters-in-latex
Example:
S = 'H\^otel, na\"\i ve, \`el\''eve';
xlabel(S, 'interpreter', 'latex')
  2 件のコメント
boureghda mohammed
boureghda mohammed 2018 年 6 月 14 日
編集済み: boureghda mohammed 2018 年 6 月 14 日
Walter Roberson, what about the accent after the letter d ( d'iteration).
Walter Roberson
Walter Roberson 2018 年 6 月 14 日
That is not an accent, that is an apostrophe.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by