
nofigs
warning off

% create screen 1
figure('Name',['AERI file: ' aeri.filename],...
    'units','norm','pos',[.23 .14 .75 .75])
uimenu('Label','   AERI RNC BROWSER:  screen # 1 ','fore',[0 0 .8]);

% get aeri field names and put them into a string array
names = fieldnames(aeri);nvars = length(names);
S=names{1};for i=2:nvars;S=[S '|' names{i}];end

frb = uicontrol('Style','frame','back',get(gcf,'Color')*.9,'pos',[0.05 0.001 0.93 .24],'units','norm');

% x-axis variables list and label
xaxis = uicontrol('Style','listbox','String',S,'pos',[0.11 .05 .25 .15],...
    'units','norm','back',[.85 .9 .85],'fore',[.2 .2 .2],...
    'Callback','cflag=4;rnccallback');
uicontrol('Style','Text','String','x-axis variable','FontWeight','b',...
    'FontSize',10,'pos',[.11 .21 .25 .02],'units','norm','FontUnits','norm',...
    'back',get(gcf,'Color')*.9);

% y-axis variables list and label
yaxis = uicontrol('Style','listbox','String',S,'pos',[0.37 .05 .25 .15],...
    'units','norm','min',0,'max',2,'back',[.85 .9 .85],'fore',[.2 .2 .2],...
    'Callback','cflag=4;rnccallback');
uicontrol('Style','Text','String','y-axis variable','FontWeight','b',...
    'FontSize',10,'pos',[.37 .21 .25 .02],'units','norm','FontUnits','norm',...
    'back',get(gcf,'Color')*.9);

% plot button
plb = uicontrol('Style','PushButton','units','norm','pos',[.63 0.16 .06 .04],...
    'Callback','cflag=1;rnccallback','back',[.8 0 0],'String','plot',...
    'fore',[.85 .85 .85],'FontWeight','b');

% output menu and label
oub = uicontrol('Style','popupmenu','units','norm','pos',[.80 0.16 .08 .04],...
    'Callback','cflag=5;rnccallback','back',[0 .7 0],'String',...
    '.ps|.jpg|.asc|.mat|screen','fore',[.2 .2 .2],'FontWeight','b');
uicontrol('Style','Text','String','output','FontWeight','b',...
    'FontSize',10,'pos',[.80 .20 .08 .02],'units','norm','FontUnits','norm',...
    'back',get(gcf,'Color')*.9,'fore',[.2 .2 .2]);

% number of subplots menu and label
npb = uicontrol('Style','popupmenu','units','norm','pos',[.89 0.16 .08 .04],...
    'Callback','cflag=7;rnccallback','back',[.8 .8 0],'String','1|2|3|4',...
    'fore',[.2 .2 .2],'FontWeight','b','Value',1);
uicontrol('Style','Text','String','no. plots','FontWeight','b',...
    'FontSize',10,'pos',[.89 .20 .08 .02],'units','norm','FontUnits','norm',...
    'back',get(gcf,'Color')*.9,'fore',[.2 .2 .2]);

% message board
msg = uicontrol('Style','edit','units','norm','pos',[.63 0.01 .34 .07],...
    'back',get(gcf,'Color'),'String','no messages','fore',[.2 .2 .2],...
    'min',0,'max',2,'hori','left');

% quit button
qb = uicontrol('Style','PushButton','units','norm','pos',[.91 0.08 .06 .04],...
    'Callback','cflag=99;rnccallback','back',[.8 0 0],'String','Quit',...
    'fore',[.85 .85 .85],'FontWeight','b');

% initailize screen with 2 subplots (this can be set up any way you want)
blowup
set(npb,'Value',2);
cflag = 7;rnccallback
junk=findobj('parent',gcf,'type','axes');
set(xaxis,'Value',102);set(yaxis,'Value',[79 107 109 111 113 115]);
set(gcf,'CurrentAxes',junk(1));cflag = 1;rnccallback
set(xaxis,'Value',102);set(yaxis,'Value',[55]);
set(gcf,'CurrentAxes',junk(2));cflag = 1;rnccallback
clear junk

% add text edit boxes for x and y variables and update w/ current editlist values
xaxis2=uicontrol('Style','edit','pos',[.11 .01 .23 .035],...
    'units','norm','String',names{get(xaxis,'Value')},...
    'Callback','cflag=2;rnccallback','back',[.85 .9 .85],'fore',[.2 .2 .2]);
yaxis2=uicontrol('Style','edit','pos',[.37 .01 .23 .035],...
    'units','norm','String',names{get(xaxis,'Value')},...
    'Callback','cflag=3;rnccallback','back',[.85 .9 .85],'fore',[.2 .2 .2]);



% create screen 2
figure('Name',['AERI file: ' aeri.filename],'units','norm','pos',[.1 .25 .75 .65])
uimenu('Label','   AERI RNC BROWSER:  screen # 2 ','fore',[0 0 .8]);

% create the editnum gui and label
sc2 = editnum(gcf,1,length(aeri.index),1,'INT_SL_B','units','norm',...
    'pos',[.61 .02 .38 .07],'callback','cflag=10;rnccallback',...
    'back',[.85 .9 .85]);
uicontrol('Style','Text','String','record # index','FontWeight','b',...
    'FontSize',10,'pos',[.61 .09 .38 .02],'units','norm','FontUnits','norm',...
    'back',get(gcf,'Color'),'fore',[.2 .2 .2]);

% create quit button
q=uicontrol('Style','PushButton','Position',[0 0 .1 .05],'Units','norm','back',[.8 0 0],...
    'String','Quit','fore',[.85 .85 .85],'Callback','cflag=98;rnccallback','FontWeight','b');

% get colors
co = get(gca,'ColorOrder');

% initailize 
hold on
s=size(aeri.mean_rad);
for i = 1:20:s(1)
set(sc2,'Value',i);cflag=10;rnccallback
end
hold off

% add blowup and hold buttons
blowup;blowup(2);holder

