Confused about num2str function

조회 수: 2 (최근 30일)
Nathaniel
Nathaniel 2012년 6월 8일
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.

채택된 답변

Wayne King
Wayne King 2012년 6월 8일
Hi, here is an example:
for nn = 1:10,
plot(randn(100,1));
title(['plot' num2str(nn)]);
pause(0.5);
end
  댓글 수: 1
Nathaniel
Nathaniel 2012년 6월 8일
This is perfect!!
Thank You

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by