plotting a figure with a variable as title

Hi, i want to plot a graph and the title of that graph should be equal to the variable mx1. how can i implement that?

 Akzeptierte Antwort

Image Analyst
Image Analyst am 25 Dez. 2014

1 Stimme

Try something like this
caption = sprintf('The result for this graph is %.3f', mx1);
title(caption, 'FontSize', 30);

Weitere Antworten (1)

Star Strider
Star Strider am 25 Dez. 2014

1 Stimme

Use sprintf:
mx1 = pi;
figure(1)
scatter(rand(10,1), rand(10,1))
grid
ttl = sprintf('Scatterplot For mx_1 = %.5f', mx1)
title(ttl)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange

Gefragt:

AA
am 25 Dez. 2014

Beantwortet:

am 25 Dez. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by