如何给 Matlab 图标题
How to give a Matlab figure title
我想给这个图一个标题,这将取决于每次迭代。会提到当前迭代的数字 i 的东西:
for i = 0:(N-1)
figure('Name','i','NumberTitle','on')
subplot(2,2,1)
...
title('Subplot 1')
subplot(2,2,2)
...
title('Subplot 2')
subplot(2,2,3)
...
title('Subplot 3')
subplot(2,2,4)
...
title('Subplot 4')
end
理想情况下,类似于:
figure('Name','for the object',i,'NumberTitle','on')
这是行不通的。
有什么办法吗?
您需要通过串联创建图形名称字符串:
figure('Name',['for the object ‘, num2str(i)], ...
我想给这个图一个标题,这将取决于每次迭代。会提到当前迭代的数字 i 的东西:
for i = 0:(N-1)
figure('Name','i','NumberTitle','on')
subplot(2,2,1)
...
title('Subplot 1')
subplot(2,2,2)
...
title('Subplot 2')
subplot(2,2,3)
...
title('Subplot 3')
subplot(2,2,4)
...
title('Subplot 4')
end
理想情况下,类似于:
figure('Name','for the object',i,'NumberTitle','on')
这是行不通的。 有什么办法吗?
您需要通过串联创建图形名称字符串:
figure('Name',['for the object ‘, num2str(i)], ...