MATLAB: Applying hold in multiple figure window?

2d plotfigureplotplotting

Dear all, I have plotted 4 different curves in 4 different windows using figure(1), figure(2), figure(3), figure(4). I want to apply 'hold' on every figure windows such that I can plot some other curves on each. If I use 'hold', Matlab is holding only figure(1) and not to others.

Best Answer

f1 = figure(1) ;ax1 = axes ;hold(ax1,'on')
f2 = figure(2) ;ax2 = axes ; hold(ax2,'on')
for i = 1:5
plot(ax1,rand(10,1))
plot(ax2,rand(10,1))
end