フィルターのクリア

Text out goes weird on Figure with underscores

16 ビュー (過去 30 日間)
Jason
Jason 2014 年 9 月 18 日
コメント済み: Jason 2014 年 9 月 18 日
Hello, I am trying to output the name of an image file I onto a figure that shows the picture. The name is obtained from and checks out OK in the matlab window.
out2 =
NoSerialNumber_R03C02_3-Swath1_C5_T05_red.tif.
However, it appears on the figure weird
Im assuming its to do with the underscores - how can I correct it? Thanks

採用された回答

Oleg Komarov
Oleg Komarov 2014 年 9 月 18 日
編集済み: Oleg Komarov 2014 年 9 月 18 日
By default the interpreter of text objects is set to 'tex'. Set it to 'none', i.e.
set(obj,'Interpreter','none')
For reference, check the text property Interpreter.
  5 件のコメント
Oleg Komarov
Oleg Komarov 2014 年 9 月 18 日
編集済み: Oleg Komarov 2014 年 9 月 18 日
Be careful when setting the defaults. It's easy to forget that did it for all cases when 'Interpreter' is a valid property. It's better to call it explicitly for the specific object.
You can use the properties directly with text():
text(2,-95,out1, 'color', 'b','FontSize',6, 'Interpreter','none');
Jason
Jason 2014 年 9 月 18 日
Thankyou, thats perfect.

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

その他の回答 (1 件)

Ilham Hardy
Ilham Hardy 2014 年 9 月 18 日
Without adjusting your interpreter setting (keep LaTeX interpreter on), you can use backslash just before the underscore to keep the underscore as underscore and not TeX command of subscript:
e.g.
title(NoSerialNumber\_R03C02\_3-Swath1_C5\_T05\_red.tif)
  1 件のコメント
Jason
Jason 2014 年 9 月 18 日
thanks for the advice, but each file I ready in has a different name so it sno possible for me to manually go and change the text to include an additional backslash.

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

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by