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
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.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for