how to read text file,showing the same formatting as text file....like BOLD,ITALIC

11 views (last 30 days)
i want to search headings from any text file

Accepted Answer

Stephen23
Stephen23 on 16 Feb 2015
Edited: Stephen23 on 16 Feb 2015
According to most common definitions of text files , they do not contain any formatting meta-data such as bold or italic information, so what you are asking for is in itself already a contradiction.
Text files might include formatting information using some kind of markup language , such as HTML or Markdown , in which case you can read this into MATLAB just by reading the text data itself.
If you are actually talking about formatted document standards (such as .doc, .odf, etc), then these do include formatting text data, but the files are in fact binary data and not text data and so cannot be (usefully) imported into MATLAB as text.
MATLAB' standard character data class also only handles raw character encoding (usually two-byte), not formatted strings, so if you need to handle strings with formatting then you would probably need to write your own data class to do this.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!