% This script illustrate a problem with the subplot function. % % When calling subplot(2,1,1) at end of script, the plot disappears % as if subplot were called with 'replace' option. % % If the subplot fct is called using handle ( subplot(sp1_handle) ), % everything is ok. close all clear clc figure sp1_handle=subplot(2,1,1) fplot (@sin, [0, 4*pi]); hold on pause(0.1) subplot(2,1,2) fplot (@sin, [0, 4*pi]); hold on pause(0.1) subplot(2,1,2) %subplot(sp1_handle) subplot(2,1,1)