How do I use an apostrophe in a title in matlab?

Written by george townsend
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How do I use an apostrophe in a title in matlab?
Strings in MATLAB must appear within a pair of apostrophes, which is a challenge when you wish to express a string containing an apostrophe. (binary digits - computer science image by drx from

As with most programming languages, strings in MATLAB must be contained within some pair of special markers to indicate that they are strings. In the case of MATLAB, apostrophes, or single quotes, are used. Regardless of which language you are using or which quoting characters are used, sometimes you need to use that special character within the string itself. Languages use a variety of strategies used to support this, and MATLAB has its own way of handling this problem. It is possible to use an apostrophe in a title in MATLAB.

Skill level:

Other People Are Reading


  1. 1

    Boot up MATLAB on your computer. All versions of MATLAB treat quoted stings the same way so the solution to this problem will work with any version.

  2. 2

    Create a simple MATLAB plot to use as a sample for the "Title" command later. A simple way to do this is to use the following command:


    This example will create a plot of a parabola.

  3. 3

    Choose an appropriate title sting containing an apostrophe to use as an example such as the following:

    This is a parabola's image.

    The sting contains an apostrophe.

  4. 4

    Use the "Title" command, replacing the example string below with the string you have chosen. Because it is a MATLAB string, it must be contained within apostrophes. Any apostrophes it contains are simply "doubled up" to indicate that one single apostrophe should be used. For the example, we have:

    title('This is a parabola''s image');

    Note that two apostrophes appear in the example word "parabola" above.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.