필터 지우기
필터 지우기

How to underline or color text in a cell

조회 수: 7 (최근 30일)
Fateme Jalali
Fateme Jalali 2016년 7월 27일
편집: Stephen23 2016년 7월 27일
Hello,I have a cell array like this cell={'hello','i','a','123','e'}.How could I determine specific cell elements by coloring or underlining? for example I want to specify cell{1}='hello' using underline.thanks
  댓글 수: 1
Stephen23
Stephen23 2016년 7월 27일
편집: Stephen23 2016년 7월 27일
@Fateme Jalali: do not get confused about what text data is:
  • character arrays store only the character number. This encodes what character it is. But it does not encode any information about the typeface (font), the size, the slant, the color, the location, the orientation, the location, the visibility, or anything else that you might dream of.
  • Formatted text (such a Word document, a PDF, or a rendered HTML page) includes lots of meta information about the formatting of the text: colors, shape, etc.
Even this website sends all of the text as simple character codes, and separately sends information about location, color, font, etc for displaying that text.
Do not confuse text data with formatted text.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 7월 27일
You cannot do that. Cell arrays do not have formatting properties. Color and underline are something that happens at display time; you might be able to set your cells so that they display the way you want, but it depends upon how you are doing the displaying.
  댓글 수: 2
Fateme Jalali
Fateme Jalali 2016년 7월 27일
Is there any way to store elements of a cell in a text file and show underlined results in a text file?
Walter Roberson
Walter Roberson 2016년 7월 27일
No. Text files do not have formatting attributes such as color and underline.
Documents might have formatting, but those are effectively binary data structures or effectively code written in a programming language such as HTML or RTF or PostScript, and it is the rendered version of them that display the color or underline.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by