How do I Use an Apostrophe in a Title in MATLAB?


As with most programing 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.

  • 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.

  • 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.

  • 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.

  • 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.

Related Searches


  • Photo Credit binary digits - computer science image by drx from
Promoted By Zergnet


Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!