matlab-情节标题中的变量

问题描述:

我想做

for i = 1 : size(N, 2)
    figure(i);
    title('N = %d', i);
%other stuff

,但是设置标题无效.为什么?

but setting the title doesn't work. Why?

因为您忘记添加sprintf

for i = 1 : size(N, 2) 
figure(i); 
title(sprintf('N = %i', i)); %# %i for integer
%other stuff
end