% Demo for andrew hurricane.

%	Copyright (c) 1984-94 by The MathWorks, Inc.

h=newplot;
clf reset
drawnow;
fs = get(gcf,'pos');
if (fs(3)<560)
  set(gcf,'pos',[fs(1) fs(2) 560 420]);
end
set(gcf,'color',[.5 .5 .5]);
set(gcf,'resize','off');
set(gca,'pos',[0.03 0.2 1 1]);
axis off;
cur_color = 'gray';
colormap(gray);
m0 = uicontrol('style','text','unit','norm','pos',[.06 .5 .8 .1]);
set(m0,'string','Please Wait .... loading 9.1 Meg of Data');
set(m0,'background',[.5 .5 .5]);
drawnow;

setmap = ['v = get(cs,''value'');' ...
           'if v==1,' ...
              'cur_color = ''gray'';' ...
           'elseif v==2,' ...
              'cur_color = ''hot'';' ...
           'elseif v==3,' ...
              'cur_color = ''cool'';' ...
           'elseif v==4,' ... 
              'cur_color = ''pink'';' ...
           'elseif v==5,' ... 
              'cur_color = ''bone'';' ...
           'elseif v==6,' ...
              'cur_color = ''hsv'';' ...
           'elseif v==7,' ...
              'cur_color = ''jet'';' ...
           'end,' ...
           'set(ce,''value'',1),' ...
           'colormap(cur_color);'];

cmc = ['omap = eval(cur_color);' ...
        'factor = get(get(gcf,''currento''),''value'');' ...
        'temp = 2*(omap.^factor);' ...
        'nmap = temp./max(max(temp));' ...
        'colormap(nmap);'];

load andrew.mat
delete(m0);
h1 = uicontrol('style','text','unit','norm','pos',[.16 .85 .6 .1]);
set(h1,'string','Hurricane Andrew: August 23-26, 1992');
set(h1,'background',[.5 .5 .5]);

if exist('andrew.mat')~=2
   ts1 = uicontrol('style','text','string', ...
                ['Sorry, file andrew.mat not available']);
   set(ts1,'unit','norm','pos',[.1 .6 .8 .1],'background',[.5 .5 .5]);
   ts2 = uicontrol('style','text','string', ...
                ['please contact your system''s administrator']);
   set(ts2,'unit','norm','pos',[.1 .5 .8 .1],'background',[.5 .5 .5]);
   ts3 = uicontrol('style','text','string', ...
                ['if you would like to install it.']);
   set(ts3,'unit','norm','pos',[.1 .4 .8 .1],'backgr',[.5 .5 .5]);
   break;
end

m1 = 'Loading movie to the Graphics Server ... please wait';

movie(y(:,1),1,30);
cs = uicontrol('style','popupmenu','string','Gray|Hot|Cool|Pink|Bone|HSV|Jet');
set(cs,'unit','norm','pos',[.763 .05 .202 .05],'callback',setmap);
h2 = uicontrol('style','text','unit','norm','string','Colormap');
set(h2,'pos',[.763 .1 .2 .05],'background',[.5 .5 .5]);
ce = uicontrol('style','slider','max',0.001,'min',2,'uni','norm');
set(ce,'value',1,'pos',[.915 .25 .05 .5],'callback',cmc);
time = uicontrol('style','edit','value',30,'string',num2str(30),'call','set(time,''value'',str2num(get(time,''string'')))');
set(time,'units','norm','pos',[.28 .07 .1 .05],'min',1,'max',1000);
tlabel = uicontrol('style','text','units','norm','pos',[.23 .13 .2 .05]);
set(tlabel,'string','Time in seconds','background',[.5 .5 .5]);
start = uicontrol('style','pushbutton','unit','norm','pos',[.06 .05 .15 .1]);
set(start,'interruptible','yes','string','Play');
set(start,'callback','disp(m1),movie(y,fix(get(time,''value'')*15/size(y,2)),15)');
mc = 'close(gcf)';
mend = uicontrol('units','norm','pos',[.45 .05 .15 .1],'style','pushbutton');
set(mend,'string','Close','callback',mc);
