Title disappears sometimes somtimes not

7 views (last 30 days)
Hi, I generate a subplot with the code below. Normally that gives me 8 subplots with a title but for some subplots the title disappears, and when I run the code again, or when I restart matlab, it is solved or other title disappear? Strange, can I solve this? thanks for any help, regardsJ
FigH=figure('name', 'LMS errorbars Campos*Sch');
Campos=[100:10:170];
for Counter= 1:8
subplot(4,2,Counter);
title(int2str(Campos(Counter)));
hold on;
StartLijn=3+4* Counter;
EindLijn= StartLijn+3;
Y=LMS(StartLijn:EindLijn,4);
E=LMS(StartLijn:EindLijn,5);
errorbar(1,Y(1),E(1),'r*')
errorbar(2,Y(2),E(2),'b^')
errorbar(3,Y(3),E(3),'m*')
errorbar(4,Y(4),E(4),'k^')
set(gca,'XTick',[1:1:4], 'XTickLabel',{'short PC' ,'short HS' ,'long PC' ,'long HS'})
end

Accepted Answer

Anthony Poulin
Anthony Poulin on 7 Jan 2013
Hy, I have not the problem when I run your code. I think it can be cause by a script execution...
Have you test to use the 'drawnow' function which force tu update the figure before execute the next line in your script. I think, it could works every time if you put this command between this lines, like this:
title(int2str(Campos(Counter)));
drawnow;
hold on;

More Answers (0)

Community Treasure Hunt

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

Start Hunting!