function GSAccessingModelData_aux(fig)
% Helper function for GSAccessingModelData


%   Copyright 1986-2004 The MathWorks, Inc.
%   $Revision: 1.1.6.1 $  $Date: 2004/08/17 21:33:01 $

clf;
ax = gca;

% parmeters
p.fs1 = 10;
p.fs2 = 12;
p.fs3 = 14;
axBorder = 0.09;
p.axpos1 = [axBorder 0.55 1-axBorder-.04 0.41];
p.axpos2 = [0 0.45 1 0.55];
p.fw1 = 'normal';
p.fw2 = 'bold';
p.fw3 = 'bold';
p.as = .05;  %---Arrow size
p.sbr = .04; %---Sumblock radius
p.s = tf('s');
p.cc1 = [1 1 .9];
p.cc2 = [.9 1 1];
p.cc3 = [1 .9 1];
p.cc4 = [.9 1 .9];
p.cc5 = [.9 .9 1];
p.cc6 = [1 .9 .9];
p.ccg = [.4 .4 .4];

set(get(ax,'parent'),'Position',[360   653   696   271])
switch fig
    case 1
        set(ax,'XLim',[-1 14],'YLim',[0 11],'Visible','off');
        text('Parent',ax,'String','Accessing Model Data','Position',[5 10],...
            'FontSize',p.fs3,'FontWeight',p.fw3,'Hor','center','Ver','middle');
        bw = 4;
        bw2 = 2.8;
        bh = 1.6;
        bh2 = 1.3;
        pos = [5 5];
        dx = 2;
        dy = 0.5;
        y1 = pos(2)+1.5*dy+1.5*bh;
        y2 = pos(2)+.5*dy+0.5*bh;
        y3 = pos(2)-.5*dy-0.5*bh;
        y4 = pos(2)-1.5*dy-1.5*bh;
        sysblock('Par',ax,'Pos',[.5 2 9 6],'Numerator',' ','Name','LTI Model Object',...
            'FaceColor',[.9 .9 .9],'FontSize',p.fs2,'FontWeight',p.fw2);
        text('Parent',ax,'String','... I/O Names ...','Position',[3 7],...
            'Color',[.8 0 0],'FontSize',p.fs1,'FontWeight',p.fw1,'Hor','center','Ver','middle');
        text('Parent',ax,'String','... Coefficients ...','Position',[5 5],...
            'Color',[.8 0 0],'FontSize',p.fs1,'FontWeight',p.fw1,'Hor','center','Ver','middle');
        text('Parent',ax,'String','... UserData ...','Position',[7.4 6.5],...
            'Color',[.8 0 0],'FontSize',p.fs1,'FontWeight',p.fw1,'Hor','center','Ver','middle');
        text('Parent',ax,'String','... Sample Time ...','Position',[2.6 3.5],...
            'Color',[.8 0 0],'FontSize',p.fs1,'FontWeight',p.fw1,'Hor','center','Ver','middle');
        text('Parent',ax,'String','... I/O Delays ...','Position',[7 3],...
            'Color',[.8 0 0],'FontSize',p.fs1,'FontWeight',p.fw1,'Hor','center','Ver','middle');
        
    case 2
        set(ax,'XLim',[-4 14],'YLim',[0 11],'Visible','off');
        text('Parent',ax,'String','Accessing Model Data with SET / GET','Position',[5 10],...
        'FontSize',p.fs3,'FontWeight',p.fw3,'Hor','center','Ver','middle')
        bw1 = 5.8;
        bh1 = 2.8;
        bw2 = 4.4;
        bh2 = 1.4;
        x1 = -1.9;
        x2 = 2.3;
        x3 = 6.7;
        x4 = 10.9;
        y1 = 7;
        y2 = 4;
        y3 = 1.9;
        sysblock('Par',ax,'Pos',[x1-bw1/2 y1-bh1/2 bw1 bh1],'Num','2 ( s + 2 )',...
            'Den','( s - 1 ) ( s - 5 )','FaceColor',p.cc2,'FontSize',p.fs2,'FontWeight',p.fw2);
        sysblock('Par',ax,'Pos',[x3-bw1/2 y1-bh1/2 bw1 bh1],'Num','7 ( s + 2 )',...
            'Den','( s - 1 ) ( s - 5 )','FaceColor',p.cc2,'FontSize',p.fs2,'FontWeight',p.fw2);
        sysblock('Par',ax,'Pos',[x2-bw2/2 y2-bh2/2 bw2 bh2],'Num','>> set(sys,''k'',7)',...
            'FaceColor',p.cc1,'FontSize',p.fs1,'FontWeight',p.fw2,'Curvature',[.5 1]);
        sysblock('Par',ax,'Pos',[x4-bw2/2 y2-bh2/2 bw2 bh2],'Num','>> get(sys,''k'')',...
            'FaceColor',p.cc1,'FontSize',p.fs1,'FontWeight',p.fw2,'Curvature',[.5 1]);
        wire('Par',ax,'XData',[x1 x1 x2-bw2/2],'YData',[y1-bh1/2 y2 y2],'Arrow',.5)
        wire('Par',ax,'XData',[x2+bw2/2 x3-bw1/6 x3-bw1/6],'YData',[y2 y2 y1-bh1/2],'Arrow',.5)
        wire('Par',ax,'XData',[x3+bw1/6 x3+bw1/6 x4-bw2/2],'YData',[y1-bh1/2 y2 y2],'Arrow',.5)
        wire('Par',ax,'XData',x4+bw2/2+[0 1],'YData',[y2 y2],'Arrow',.5)
        text('Parent',ax,'String','  7','Position',[x4+bw2/2+1 y2],...
            'Color',[.8 0 0],'FontSize',p.fs3,'FontWeight',p.fw3,'Hor','left','Ver','middle');

    case 3
        set(ax,'XLim',[-4 14],'YLim',[0 11],'Visible','off')
        text('Parent',ax,'String','Direct Structure Referencing','Position',[5 10],...
            'FontSize',p.fs3,'FontWeight',p.fw3,'Hor','center','Ver','middle');
        bw1 = 5.8;
        bh1 = 2.8;
        bw2 = 4.4;
        bh2 = 1.4;
        x1 = -1.9;
        x2 = 2.3;
        x3 = 6.7;
        x4 = 10.9;
        y1 = 7;
        y2 = 4;
        y3 = 1.9;
        GRAY = [.45 .45 .45];
        sysblock('Par',ax,'Pos',[x1-bw1/2 y1-bh1/2 bw1 bh1],'Num','2 ( s + 2 )',...
            'Den','( s - 1 ) ( s - 5 )','FaceColor',p.cc2,'FontSize',p.fs2,'FontWeight',p.fw2);
        sysblock('Par',ax,'Pos',[x3-bw1/2 y1-bh1/2 bw1 bh1],'Num','7 ( s + 2 )',...
            'Den','( s - 1 ) ( s - 5 )','FaceColor',p.cc2,'FontSize',p.fs2,'FontWeight',p.fw2);
        sysblock('Par',ax,'Pos',[x2-bw2/2 y2-bh2/2 bw2 bh2],'Num','>> set(sys,''k'',7)',...
            'FaceColor',p.cc1,'FontSize',p.fs1,'FontWeight',p.fw2,'Curvature',[.5 1],'EdgeColor',GRAY);
        sysblock('Par',ax,'Pos',[x4-bw2/2 y2-bh2/2 bw2 bh2],'Num','>> get(sys,''k'')',...
            'FaceColor',p.cc1,'FontSize',p.fs1,'FontWeight',p.fw2,'Curvature',[.5 1],'EdgeColor',GRAY);
        sysblock('Par',ax,'Pos',[x2-bw2/2 y3-bh2/2 bw2 bh2],'Num','>> sys.k = 7',...
            'FaceColor',p.cc1,'FontSize',p.fs1,'FontWeight',p.fw2,'Curvature',[.5 1]);
        sysblock('Par',ax,'Pos',[x4-bw2/2 y3-bh2/2 bw2 bh2],'Num','>> sys.k',...
            'FaceColor',p.cc1,'FontSize',p.fs1,'FontWeight',p.fw2,'Curvature',[.5 1]);
        wire('Par',ax,'XData',[x1 x2-bw2/2],'YData',[y2 y2],'Arrow',.5,'Color',GRAY)
        wire('Par',ax,'XData',[x2+bw2/2 x3-bw1/6],'YData',[y2 y2],'Arrow',0,'Color',GRAY)
        wire('Par',ax,'XData',[x3+bw1/6 x4-bw2/2],'YData',[y2 y2],'Arrow',.5,'Color',GRAY)
        wire('Par',ax,'XData',x4+bw2/2+[0 1],'YData',[y2 y2],'Arrow',.5,'Color',GRAY)
        text('Parent',ax,'String','  7','Position',[x4+bw2/2+1 y2],...
            'Color',[.8 0 0],'FontSize',p.fs3,'FontWeight',p.fw3,'Hor','left','Ver','middle');
        wire('Par',ax,'XData',[x1 x1 x2-bw2/2],'YData',[y1-bh1/2 y3 y3],'Arrow',.5)
        wire('Par',ax,'XData',[x2+bw2/2 x3-bw1/6 x3-bw1/6],'YData',[y3 y3 y1-bh1/2],'Arrow',.5)
        wire('Par',ax,'XData',[x3+bw1/6 x3+bw1/6 x4-bw2/2],'YData',[y1-bh1/2 y3 y3],'Arrow',.5)
        wire('Par',ax,'XData',x4+bw2/2+[0 1],'YData',[y3 y3],'Arrow',.5)
        text('Parent',ax,'String','  7','Position',[x4+bw2/2+1 y3],...
            'Color',[.8 0 0],'FontSize',p.fs3,'FontWeight',p.fw3,'Hor','left','Ver','middle');

    case 4
        set(ax,'XLim',[-2 14],'YLim',[0 11],'Visible','off');
        text('Parent',ax,'String','Data Retrieval:  Quick Access','Position',[5 10],...
            'FontSize',p.fs3,'FontWeight',p.fw3,'Hor','center','Ver','middle');
        bw = 4;
        bw2 = 2.8;
        bh = 1.6;
        bh2 = 1.3;
        pos = [5 5];
        dx = 2;
        dy = 0.5;
        y1 = pos(2)+1.5*dy+1.5*bh;
        y2 = pos(2)+.5*dy+0.5*bh;
        y3 = pos(2)-.5*dy-0.5*bh;
        y4 = pos(2)-1.5*dy-1.5*bh;
        sysblock('Par',ax,'Pos',[pos(1)-bw/2-dx-bw2 y2-bh2/2 bw2 bh2],'Num','sys','Name','(TF/ZPK/SS)',...
            'NameFontSize',p.fs1,'NameFontWeight',p.fw1,'FaceColor',[.9 .9 .9],'FontSize',p.fs3,'FontWeight',p.fw3);
        sysblock('Par',ax,'Pos',[pos(1)-bw/2-dx-bw2 y4-bh2/2 bw2 bh2],'Num','sysfr','Name','(FRD)',...
            'NameFontSize',p.fs1,'NameFontWeight',p.fw1,'FaceColor',[.9 .9 .9],'FontSize',p.fs3,'FontWeight',p.fw3);
        sysblock('Par',ax,'Pos',[pos(1)-bw/2 y1-bh/2 bw bh],'Num','TFDATA',...
            'FaceColor',p.cc1,'FontSize',p.fs3,'FontWeight',p.fw3,'Curvature',[.5 1]);
        sysblock('Par',ax,'Pos',[pos(1)-bw/2 y2-bh/2 bw bh],'Num','ZPKDATA',...
            'FaceColor',p.cc2,'FontSize',p.fs3,'FontWeight',p.fw3,'Curvature',[.5 1]);
        sysblock('Par',ax,'Pos',[pos(1)-bw/2 y3-bh/2 bw bh],'Num','SSDATA',...
            'FaceColor',p.cc3,'FontSize',p.fs3,'FontWeight',p.fw3,'Curvature',[.5 1]);
        sysblock('Par',ax,'Pos',[pos(1)-bw/2 y4-bh/2 bw bh],'Num','FRDATA',...
            'FaceColor',p.cc4,'FontSize',p.fs3,'FontWeight',p.fw3,'Curvature',[.5 1]);
        wire('Par',ax,'XData',pos(1)-bw/2+[-dx 0],'YData',[y2 y2],'Arrow',.5)
        wire('Par',ax,'XData',pos(1)-bw/2+[-dx/2 -dx/2 0],'YData',[y2 y1 y1],'Arrow',.5)
        wire('Par',ax,'XData',pos(1)-bw/2+[-dx/2 -dx/2 0],'YData',[y2 y3 y3],'Arrow',.5)
        wire('Par',ax,'XData',pos(1)-bw/2+[-dx 0],'YData',[y4 y4],'Arrow',.5)
        wire('Par',ax,'XData',pos(1)+bw/2+[0 dx],'YData',[y1 y1],'Arrow',.5)
        wire('Par',ax,'XData',pos(1)+bw/2+[0 dx],'YData',[y2 y2],'Arrow',.5)
        wire('Par',ax,'XData',pos(1)+bw/2+[0 dx],'YData',[y3 y3],'Arrow',.5)
        wire('Par',ax,'XData',pos(1)+bw/2+[0 dx],'YData',[y4 y4],'Arrow',.5)
        t1=text('Parent',ax,'String',' [num,den,Ts]','Position',[pos(1)+bw/2+dx y1],...
            'FontSize',p.fs2,'FontWeight',p.fw1,'Hor','left','Ver','middle');
        t2=text('Parent',ax,'String',' [z,p,k,Ts]','Position',[pos(1)+bw/2+dx y2],...
            'FontSize',p.fs2,'FontWeight',p.fw1,'Hor','left','Ver','middle');
        text('Parent',ax,'String',' [a,b,c,d,Ts]','Position',[pos(1)+bw/2+dx y3],...
            'FontSize',p.fs2,'FontWeight',p.fw1,'Hor','left','Ver','middle');
        text('Parent',ax,'String',' [response,freq,Ts]','Position',[pos(1)+bw/2+dx y4],...
            'FontSize',p.fs2,'FontWeight',p.fw1,'Hor','left','Ver','middle');


end




