casegrid minorgrid onguihold onplot

Quick question. My GUI has "axes1"(graph), this graph refreshes if I click a certain PushButton. The thing is my graph has two plots. One is the main one and the other is just there as a limit. I separated them with HOLD ON. All is OK, but when I hit refresh the grid disappears, if I click again it suddenly reappears. The only way that I could get it to stay is by deleting the other minor "plot". I tried putting them together in one plot but no luck. I tried placing "grid minor" everywhere but still nothing.
I used "case" structure.
Any suggestions?
My Code :
case 2
fid = fopen('ICl.txt');
A = textscan(fid, '%f %*f %f %*s');
startDate = datenum('01-01-2011')
endDate = datenum('12-31-2011')
xData = linspace(startDate,endDate,12);
plot(A{1,1},A{1,2}, '--ks','LineWidth',2,...
ylim([0 inf])
set(gca,'YTick',[0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1])
title('JODOV KLORID (datum odprtja: 11.4.2010)')
grid minor;
hold on;
x = 734506:1:734867;
y = 100;
plot(x, y, 'rs', 'LineWidth', 3, 'MarkerSize', 1.5);

Best Answer

  • I may be oversimplifying it, but perhaps issue a
    hold off
    at the end of the code and see if this gives you behavior you desire.
    grid minor is a toggle, so that if you issue it and then have a hold on, then when it is issued again, it will toggle off.