Home > atmlab > graphs > new_figure.m

new_figure

PURPOSE ^

NEW_FIGURE Creates a new figure window

SYNOPSIS ^

function h = new_figure( strategy )

DESCRIPTION ^

 NEW_FIGURE   Creates a new figure window

    Works as a plain call of the standard *figure* function (a
    call without an input argument), but has two options for which
    figure to open:
 
       append: The number of the new figure will have number n+1, 
               where n is the old maximum figure number.
       fill  : The new figure will be placed in the first free slot.
  
    The *figure* uses the 'fill' strategy. 

 FORMAT   h = new_figure( [strategy] )
        
 OUT   h
 OPT   strategy   Open strategy, see above. Default is 'append'.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

new_figure.m

SOURCE CODE ^

0001 % NEW_FIGURE   Creates a new figure window
0002 %
0003 %    Works as a plain call of the standard *figure* function (a
0004 %    call without an input argument), but has two options for which
0005 %    figure to open:
0006 %
0007 %       append: The number of the new figure will have number n+1,
0008 %               where n is the old maximum figure number.
0009 %       fill  : The new figure will be placed in the first free slot.
0010 %
0011 %    The *figure* uses the 'fill' strategy.
0012 %
0013 % FORMAT   h = new_figure( [strategy] )
0014 %
0015 % OUT   h
0016 % OPT   strategy   Open strategy, see above. Default is 'append'.
0017 
0018 % 2013-09-03   Created by Patrick Eriksson.
0019 
0020 
0021 function h = new_figure( strategy )
0022 %
0023 if nargin < 1, strategy = 'append'; end
0024 
0025 figHandles = findobj( 'Type', 'figure' );
0026 
0027 switch lower( strategy )
0028   
0029  case 'append' 
0030   if isempty(figHandles)
0031     h = figure(1);
0032   else
0033     h = figure( max(figHandles) + 1 );    
0034   end
0035 
0036  case 'fill' 
0037   h = figure;
0038 
0039  otherwise
0040   error( 'The argument *strategy* must be ''append'' or ''fill''.' );
0041 end

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005