matlab-情节标题中的变量 [英] matlab - variable in plot title

查看:259
本文介绍了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

这篇关于matlab-情节标题中的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆