フィルターのクリア

how to choose a certain color for a string?

28 ビュー (過去 30 日間)
jojototo
jojototo 2016 年 4 月 6 日
編集済み: per isakson 2016 年 6 月 8 日
I have a text document which contains the word 'hello' how could I write this word in blue,or generally how to set a color for a string in matlab

回答 (2 件)

Image Analyst
Image Analyst 2016 年 4 月 6 日
Use the color option to place your string onto your axes:
text(x, y, yourString, 'Color', 'r');
Color can also be a 3 number array for [r,g,b] with values in the range 0-1 to get any color you want. You can also change font size and font name with appropriate options,
  5 件のコメント
Image Analyst
Image Analyst 2016 年 6 月 5 日
When I said "View/Macros/Record Macro..." that is doing that from Microsoft Word. Just look at the tool ribbon in Word.
jojototo
jojototo 2016 年 6 月 8 日
thank you so much,I WILL TRY IT

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


Walter Roberson
Walter Roberson 2016 年 4 月 6 日
If you need to set the color inside the text document then you cannot do that: plain text does not have a color.
Changing the color of text can be done in some human-readable formats such as RTF; for example (thanks to pindari.com)
{\rtf1\ansi\deff0
{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}
This line is the default color\line
\cf2
This line is red\line
\cf1
This line is the default color
}
You might be able to set color in Excel files, under some conditions.
If the goal is to write to the command window rather than to save to a file, then see File Exchange
  4 件のコメント
jojototo
jojototo 2016 年 6 月 5 日
I mean a word document, sorry for my late reply,
per isakson
per isakson 2016 年 6 月 8 日
編集済み: per isakson 2016 年 6 月 8 日

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by