【问题标题】:matlab - variable in plot titlematlab - 情节标题中的变量
【发布时间】:2011-04-12 11:23:44
【问题描述】:

我想做

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

但设置标题不起作用。为什么?

【问题讨论】:

    标签: matlab plot


    【解决方案1】:

    因为你忘了加sprintf

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

    【讨论】:

      【解决方案2】:

      num2str 应该也可以。

      title(['N = ',num2str(i)]);
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-12-03
        • 2021-02-19
        • 1970-01-01
        • 2016-10-28
        • 2014-10-21
        • 1970-01-01
        • 1970-01-01
        • 2019-08-28
        相关资源
        最近更新 更多