MATLAB: Input a variable into a plot title

inputplotplot titleplot variablestringtitletitle variablevariablevariable string

I've trawled through these forums and found loads on inputting variables as titles, however, none of them work for me. Im trying to change the title of a plot with respect to a parameter the user will enter in the function. First i call a string for example
str = sprintf('just an example of %d that isnt working', variable)
title(str)
However only the 'just an example of' is printed out on the title of the plot, everything after and including the variable has dissapeared, this happens when i move the variable about in the title too.
Cheers!

Best Answer

With the introduction of the string array in release R2016b (and the ability to enclose text data in double quotes to create a string in release R2017a) you can also use:
plot((1:10).^2)
f = 70;
c = (f-32)/1.8;
title("Temperature is " + c + " C")