www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/MakeAxestheCurrentAxesExample.m

    %% Make Subplot Axes the Current Axes  
% Make a subplot the current axes using its axes handle.   

% Copyright 2015 The MathWorks, Inc.


%% 
% Create a figure with multiple subplots. Store the subplot axes handles 
% in vector |h|. 
figure;
for k = 1:4
    h(k) = subplot(2,2,k);
end  

%% 
% Make the second subplot the current axes. Plot a sine wave and change
% the axis limits. 
x = linspace(1,50);
y = sin(x);

subplot(h(2))
plot(x,y,'Color',[0.1, 0.5, 0.1])
title('Second Subplot')
axis([0,50,-1,1])