Effacer les filtres
Effacer les filtres

Confused about num2str function

11 vues (au cours des 30 derniers jours)
Nathaniel
Nathaniel le 8 Juin 2012
I have looked at the online help the very first line reads:
"The num2str function converts numbers to their string representations. This function is useful for labeling and titling plots with numeric values."
This is exactly what I want to use it for, I have to plot a function every time a for loop reiterates itself And I want to change the title of each successive plot to "plot1" "plot2" "plot3" and so on....
But I have not found a way to do this.

Réponse acceptée

Wayne King
Wayne King le 8 Juin 2012
Hi, here is an example:
for nn = 1:10,
plot(randn(100,1));
title(['plot' num2str(nn)]);
pause(0.5);
end
  1 commentaire
Nathaniel
Nathaniel le 8 Juin 2012
This is perfect!!
Thank You

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by