function fig = PLCNNmenu(action, varargin)

if nargin<1,
  action='InitializePLCNNmenu';
end;

feval(action,varargin{:});
return;

%%%
%%%   Sub-function - InitializePLviewautoID
%%%

function InitializePLCNNmenu()
%Close prior window
if ~isempty(findobj('Type','figure','Name','VPR Image Classification')),close('VPR Image Classification');end
h=gcbf;
redgreenblue=[0.2157 .6353 .6353]*1.2;

h0 = figure('Units','normalized', ...
	'Color',[redgreenblue], ...
	'Colormap','default', ...
	'FileName','c:\plgui\mygui\PLCNNmenu.m', ...
	'MenuBar','none', ...
	'Name','VPR CNN Automatic Annotation Menu', ...
	'NumberTitle','off', ...
	'PaperPosition',[18 180 576 432], ...
	'PaperUnits','points', ...
	'Position',[0.0059 0.3802 0.2598 0.5443], ...
	'Tag','VPR CNN Menu', ...
	'ToolBar','none');
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[redgreenblue]*1.1, ...
	'ListboxTop',0, ...
	'Position',[0.086 0.053 0.808 0.899], ...
	'Style','frame', ...
	'Tag','Frame1');

%SELECT CLASSIFIER
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[redgreenblue]*1.1, ...
	'fontunits','normalized','fontsize',.65, ...
	'FontWeight','normal', ...
	'ListboxTop',0, ...
	'Position',[0.2 0.875 0.25 0.041], ...
    'HorizontalAlignment','right', ...
	'String','Classifier', ...
	'Style','text', ...
	'Tag','StaticText Classifier', ...
	'TooltipString','Select Classifier');
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'ListboxTop',0, ...
	'Position',[0.5 0.87 0.351 0.053], ...
	'String','', ...
    'fontunits','normalized','fontsize',0.4, ...
	'Style','edit', ...
	'TooltipString','Enter classifier name and full path, or use button below.', ...
    'Tag','EditText Classifier Path');
h1 = uicontrol('Parent',h0, ...  
    'Units','normalized', ...
    'BackgroundColor',[redgreenblue]*1.1, ...
    'Callback','PLCNNmenu GetClassifier', ...
    'Position',[0.293 0.81 0.429 0.050], ...
    'String','Find Classifier', ...
    'fontunits','normalized','fontsize',.528, ...
    'FontWeight','normal', ...
    'Style','pushbutton', ...
    'Tag','PushButton Find Classifier', ...
    'TooltipString',['Push to easily enter the classifier file.']);

%SELECT AUTOID DRIVE
autoiddrives=str2mat(getdrives('-nofloppy'));
autoiddrives=str2mat('Select',autoiddrives);
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[redgreenblue]*1.1, ...
	'fontunits','normalized','fontsize',.65, ...
	'FontWeight','normal', ...
	'ListboxTop',0, ...
	'Position',[0.2 0.755 0.25 0.041], ...
    'HorizontalAlignment','right', ...
	'String','AutoID Drive', ...
	'Style','text', ...
	'Tag','StaticText AutoID Drive', ...
	'TooltipString','Select Drive Letter where AutoID files will be saved');
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Callback','PLCNNmenu GetAutoIDFolders', ...
	'HorizontalAlignment','left', ...
	'ListboxTop',0, ...
	'Position',[0.5 0.75 0.351 0.053], ...
	'String',autoiddrives, ...
    'value',1, ...
	'fontunits','normalized','fontsize',.4, ...
	'FontWeight','normal', ...
	'Style','popupmenu', ...
	'Tag','PopupMenu AutoID Drive', ...
	'TooltipString','Select Drive Letter where AutoID files will be saved') ;

%SELECT AUTOID FOLDER
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[redgreenblue]*1.1, ...
	'fontunits','normalized','fontsize',.65, ...
	'FontWeight','normal', ...
	'ListboxTop',0, ...
	'Position',[0.2 0.695 0.25 0.041], ...
    'HorizontalAlignment','right', ...
	'String','AutoID Folder', ...
	'Style','text', ...
	'Tag','StaticText AutoID Folder', ...
	'TooltipString','Select folder where AutoID files will be saved') ;

%SELECT ROI DRIVE LETTER
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[redgreenblue]*1.1, ...
	'fontunits','normalized','fontsize',.65, ...
	'FontWeight','normal', ...
	'ListboxTop',0, ...
	'Position',[0.2 0.635 0.25 0.041], ...
    'HorizontalAlignment','right', ...
	'String','ROI Drive', ...
	'Style','text', ...
	'Tag','StaticText ROI Drive', ...
	'TooltipString','Select Drive Letter where ROIs are located');

%SELECT ROI BASE FOLDER
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[redgreenblue]*1.1, ...
	'fontunits','normalized','fontsize',.65, ...
	'FontWeight','normal', ...
	'ListboxTop',0, ...
	'Position',[0.2 0.575 0.25 0.041], ...
    'HorizontalAlignment','right', ...
	'String','ROI Folder', ...
	'Style','text', ...
	'Tag','StaticText ROI Folder', ...
	'TooltipString','Select folder where ROIs are located');

%SELECT Cruise
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[redgreenblue]*1.1, ...
	'fontunits','normalized','fontsize',.65, ...
	'FontWeight','normal', ...
	'ListboxTop',0, ...
	'Position',[0.2 0.515 0.25 0.041], ...
    'HorizontalAlignment','right', ...
	'String','Cruise', ...
	'Style','text', ...
	'Tag','StaticText Cruise', ...
	'TooltipString','Select Cruise');

%SELECT VPR NUMBER
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[redgreenblue]*1.1, ...
	'fontunits','normalized','fontsize',.65, ...
	'FontWeight','normal', ...
	'ListboxTop',0, ...
	'Position',[0.2 0.395 0.25 0.041], ...
    'HorizontalAlignment','right', ...
	'String','VRR Number', ...
	'Style','text', ...
	'Tag','StaticText VPR Number', ...
	'TooltipString','Select VPR Cast/Tow Number');

%SELECT Yearday
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[redgreenblue]*1.1, ...
	'fontunits','normalized','fontsize',.65, ...
	'FontWeight','normal', ...
	'ListboxTop',0, ...
	'Position',[0.2 0.215 0.25 0.041], ...
    'HorizontalAlignment','right', ...
	'String','Yearday', ...
	'Style','text', ...
	'Tag','StaticText Yearday', ...
	'TooltipString','Select Yearday');

%SELECT Hour
h1 = uicontrol('Parent',h0, ...
	'Units','normalized', ...
	'BackgroundColor',[redgreenblue]*1.1, ...
	'fontunits','normalized','fontsize',.65, ...
	'FontWeight','normal', ...
	'ListboxTop',0, ...
	'Position',[0.2 0.155 0.25 0.041], ...
    'HorizontalAlignment','right', ...
	'String','Hour', ...
	'Style','text', ...
	'Tag','StaticText Hour', ...
	'TooltipString','Select Hour');

if nargout > 0, fig = h0; end

function GetClassifier
h=gcbf; 
if ~isempty(h)
    if exist(['C:' filesep 'plgui' filesep 'ifcb-run' filesep 'models'])==7
        cd(['C:' filesep 'plgui' filesep 'ifcb-run' filesep 'models'])
    end
    [file,path] = uigetfile('*.pt');
    if nargin<1,
        h=gcbf;
    else
        h=fig;
    end;
    if ~isempty(h)
        h1=findobj(h,'Tag','EditText Classifier Path');
        set(h1,'String',[path,file]);
    end
    cd(['C:' filesep 'plgui' filesep 'mygui'])
end

function GetAutoIDFolders(fig)

if nargin<1,
	h=gcbf;
else
	h=fig;
end;

if ~isempty(h)
  %delete existing popups
	h1=findobj(h,'Tag','PopupMenu AutoID Folder'); delete(h1);
    h1=findobj(h,'Tag','PopupMenu ROI Drive'); delete(h1);
    h1=findobj(h,'Tag','PopupMenu ROI Folder'); delete(h1);
	h1=findobj(h,'Tag','PopupMenu Cruise'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify Cruise'); delete(h1);
    h1=findobj(h,'Tag','PopupMenu VPR Number'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify VPR'); delete(h1);
	h1=findobj(h,'Tag','PopupMenu Yearday'); delete(h1);
	h1=findobj(h,'Tag','PopupMenu Hour'); delete(h1);
	%find folders
	h1=findobj(h,'Tag','PopupMenu AutoID Drive');
	dummystring=get(h1,'String');v=get(h1,'value');
	disc=deblank(dummystring(v,:));
	folders=dir(disc);
	folderarray=str2mat(folders.name);
	folderarray=lower(folderarray([folders.isdir]',:));
	sz=size(folderarray,1);
	if sz>2,
        count=1;
        if strcmp(folderarray(1,1),'.'),count=2;end
        if strcmp(folderarray(2,1),'.'),count=3;end
        folderarray=sortrows(folderarray(count:sz,:));
        folderarray=str2mat('Select',folderarray);
        h1 = uicontrol('Parent',h, ...  
            'Units','normalized', ...
            'BackgroundColor',[1 1 1], ...
            'ListboxTop',0, ...
            'Position',[0.5 0.69 0.351 0.053], ...
            'Callback','PLCNNmenu GetROIDrives', ...
            'String',folderarray, ...
            'fontunits','normalized','fontsize',.4, ...
            'FontWeight','normal', ...
            'max',sz+1, ...
            'min',1, ...
            'Style','popupmenu', ...
            'Tag','PopupMenu AutoID Folder', ...
            'TooltipString','Select folder where AutoID files will be saved', ...
            'Value',1);
  end
end

function GetROIDrives(fig)
if nargin<1,
	h=gcbf;
else
	h=fig;
end;
if ~isempty(h)
	%delete existing popups
    h1=findobj(h,'Tag','PopupMenu ROI Drive'); delete(h1);
    h1=findobj(h,'Tag','PopupMenu ROI Folder'); delete(h1);
    h1=findobj(h,'Tag','PopupMenu Cruise'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify Cruise'); delete(h1);
    h1=findobj(h,'Tag','PopupMenu VPR Number'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify VPR'); delete(h1);
    h1=findobj(h,'Tag','PopupMenu Yearday'); delete(h1);
  	h1=findobj(h,'Tag','PopupMenu Hour'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify Hour'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify Underway'); delete(h1);
	%Get ROI Drives
    comp=computer;
    if strcmp(comp(1:3),'MAC');
        a=dir('/Volumes');
        for j=3:size(a,1),a(j).name=['/Volumes/' a(j).name '/'];end
        roidrives=str2mat(a(3:end).name);
    else
        roidrives=str2mat(getdrives('-nofloppy'));
    end
    roidrives=str2mat('Select',roidrives);
    h1 = uicontrol('Parent',h, ...
        'Units','normalized', ...
        'BackgroundColor',[1 1 1], ...
        'Callback','PLCNNmenu GetROIFolders', ...
        'HorizontalAlignment','left', ...
        'ListboxTop',0, ...
        'Position',[0.5 0.63 0.351 0.053], ...
        'String',roidrives, ...
        'value',1, ...
        'fontunits','normalized','fontsize',.4, ...
        'FontWeight','normal', ...
        'Style','popupmenu', ...
        'Tag','PopupMenu ROI Drive', ...
        'TooltipString','Select Drive Letter where ROIs are located') ;
end

function GetROIFolders(fig)

if nargin<1,
	h=gcbf;
else
	h=fig;
end;

if ~isempty(h)
	%delete existing popups
	h1=findobj(h,'Tag','PopupMenu ROI Folder'); delete(h1);
	h1=findobj(h,'Tag','PopupMenu Cruise'); delete(h1);
	h1=findobj(h,'Tag','PushButton Classify Cruise'); delete(h1);
    h1=findobj(h,'Tag','PopupMenu VPR Number'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify VPR'); delete(h1);
	h1=findobj(h,'Tag','PopupMenu Yearday'); delete(h1);
	h1=findobj(h,'Tag','PopupMenu Hour'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify Hour'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify Underway'); delete(h1);
	%find ROI folders
	h1=findobj(h,'Tag','PopupMenu ROI Drive');
	dummystring=get(h1,'String');v=get(h1,'value');
	disc=deblank(dummystring(v,:));
	folders=dir(disc);
	folderarray=str2mat(folders.name);
	folderarray=lower(folderarray([folders.isdir]',:));
	sz=size(folderarray,1);
	if sz>2,
        count=1;
        if strcmp(folderarray(1,1),'.'),count=2;end
        if strcmp(folderarray(2,1),'.'),count=3;end
        folderarray=sortrows(folderarray(count:sz,:));
        folderarray=str2mat('Select',folderarray);
        h1 = uicontrol('Parent',h, ...
            'Units','normalized', ...
            'BackgroundColor',[1 1 1], ...
            'Callback','PLCNNmenu GetCruises', ...
            'ListboxTop',0, ...
            'Position',[0.5 0.57 0.351 0.053], ...
            'String',folderarray, ...
            'fontunits','normalized','fontsize',.4, ...
            'FontWeight','normal', ...
            'max',sz+1, ...
            'min',1, ...
            'Style','popupmenu', ...
            'Tag','PopupMenu ROI Folder', ...
            'TooltipString','Select Folder where ROIs are located', ...
            'Value',1);
	end
end

function GetCruises(fig)

if nargin<1,
	h=gcbf;
else
	h=fig;
end;

if ~isempty(h)
	%delete existing popups
	h1=findobj(h,'Tag','PopupMenu Cruise'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify Cruise'); delete(h1);
    h1=findobj(h,'Tag','PopupMenu VPR Number'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify VPR'); delete(h1);
	h1=findobj(h,'Tag','PopupMenu Yearday'); delete(h1);
	h1=findobj(h,'Tag','PopupMenu Hour'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify Hour'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify Underway'); delete(h1);
	%find cruises
	h1=findobj(h,'Tag','PopupMenu ROI Drive');
	dummystring=get(h1,'String');v=get(h1,'value');
	disc=deblank(dummystring(v,:));
	h1=findobj(h,'Tag','PopupMenu ROI Folder');
	dummystring=get(h1,'String');v=get(h1,'value');
	folder=deblank(dummystring(v,:));
	basepath=[disc folder];
	cruises=dir(basepath);
	cruisearray=str2mat(cruises.name);
	sz=size(cruisearray,1);
	if sz>2,    
        cruisearray=sortrows(cruisearray(3:sz,:));
        cruisearray=str2mat('Select',cruisearray);
        h1 = uicontrol('Parent',h, ...  
            'Units','normalized', ...
            'BackgroundColor',[1 1 1], ...
            'Callback','PLCNNmenu GetVPRNum', ...
            'ListboxTop',0, ...
            'Position',[0.5 0.51 0.351 0.053], ...
            'String',cruisearray, ...
            'fontunits','normalized','fontsize',.4, ...
            'FontWeight','normal', ...
            'max',sz+1, ...
            'min',1, ...
            'Style','popupmenu', ...
            'Tag','PopupMenu Cruise', ...
            'TooltipString','Select Cruise', ...
            'Value',1);
	end
end

function GetVPRNum(fig)
if nargin<1,
	h=gcbf;
else
	h=fig;
end;
if ~isempty(h)
    %Create Classify Entire Cruise Button
	h1 = uicontrol('Parent',h, ...  
        'Units','normalized', ...
        'BackgroundColor',[0.2157 .6353 .6353]*1.2*1.1, ...
        'Callback','CNNClassify(''c'')', ...
        'Position',[0.293 0.455 0.429 0.050], ...
        'String','Classify Entire Cruise', ...
        'fontunits','normalized','fontsize',.528, ...
        'FontWeight','normal', ...
        'Style','pushbutton', ...
        'Tag','PushButton Classify Cruise', ...
        'TooltipString','Push to classify the entire cruise');
    %delete existing Yearday and Hour popups
	h1=findobj(h,'Tag','PopupMenu Yearday'); delete(h1);
	h1=findobj(h,'Tag','PopupMenu Hour'); delete(h1);
    h1=findobj(h,'Tag','PopupMenu VPR Number'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify VPR'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify Hour'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify Underway'); delete(h1);
    %Get VPR Number
    h1=findobj(h,'Tag','PopupMenu ROI Drive');
	dummystring=get(h1,'String');v=get(h1,'value');
	disc=deblank(dummystring(v,:));
	h1=findobj(h,'Tag','PopupMenu ROI Folder');
	dummystring=get(h1,'String');v=get(h1,'value');
	folder=deblank(dummystring(v,:));
	basepath=[disc folder];
	h1=findobj(h,'Tag','PopupMenu Cruise');
	dummystring=get(h1,'String');v=get(h1,'value');
	cruise=deblank(dummystring(v,:));
	vprnum=dir([basepath filesep cruise filesep 'rois']);
	vprnumarray=str2mat(vprnum.name);
	sz=size(vprnumarray,1);
	if sz>2,
        vprnumarray=sortrows(vprnumarray(3:sz,:));
        vprnumarray=str2mat('Select',vprnumarray);
        h1 = uicontrol('Parent',h, ...  
            'Units','normalized', ...
            'BackgroundColor',[1 1 1], ...
            'Callback','PLCNNmenu GetYearday', ...
            'ListboxTop',0, ...
            'Position',[0.5 0.39 0.351 0.053], ...
            'String',vprnumarray, ...
            'fontunits','normalized','fontsize',.4, ...
            'FontWeight','normal', ...
            'max',sz+1, ...
            'min',1, ...
            'Style','popupmenu', ...
            'Tag','PopupMenu VPR Number', ...
            'TooltipString','Select VPR Cast/Tow Number', ...
            'Value',1);
    end
end
    
function GetYearday(fig)
if nargin<1,
	h=gcbf;
else
	h=fig;
end;
if ~isempty(h)
    %Create Classify VPR Cast/Tow Button
	h1 = uicontrol('Parent',h, ...  
        'Units','normalized', ...
        'BackgroundColor',[0.2157 .6353 .6353]*1.2*1.1, ...
        'Callback','CNNClassify(''v'')', ...
        'Position',[0.293 0.335 0.429 0.050], ...
        'String','Classify VPR Cast/Tow', ...
        'fontunits','normalized','fontsize',.528, ...
        'FontWeight','normal', ...
        'Style','pushbutton', ...
        'Tag','PushButton Classify VPR', ...
        'TooltipString','Push to classify the entire VPR Cast/Tow');
    %Create Classify Underway Button
	h1 = uicontrol('Parent',h, ...  
        'Units','normalized', ...
        'BackgroundColor',[0.2157 .6353 .6353]*1.2*1.1, ...
        'Callback','CNNClassifyUnderway', ...
        'Position',[0.293 0.275 0.429 0.050], ...
        'String','Classify Underway', ...
        'fontunits','normalized','fontsize',.528, ...
        'FontWeight','normal', ...
        'Style','pushbutton', ...
        'Tag','PushButton Classify Underway', ...
        'TooltipString','Push to classify as more ROIs are extracted');
    %delete existing Yearday and Hour popups
	h1=findobj(h,'Tag','PopupMenu Yearday'); delete(h1);
	h1=findobj(h,'Tag','PopupMenu Hour'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify Hour'); delete(h1);
    %Get Yearday
	h1=findobj(h,'Tag','PopupMenu ROI Drive');
	dummystring=get(h1,'String');v=get(h1,'value');
	disc=deblank(dummystring(v,:));
	h1=findobj(h,'Tag','PopupMenu ROI Folder');
	dummystring=get(h1,'String');v=get(h1,'value');
	folder=deblank(dummystring(v,:));
	basepath=[disc folder];
	h1=findobj(h,'Tag','PopupMenu Cruise');
	dummystring=get(h1,'String');v=get(h1,'value');
	cruise=deblank(dummystring(v,:));
    h1=findobj(h,'Tag','PopupMenu VPR Number');
	dummystring=get(h1,'String');v=get(h1,'value');
	vpr=deblank(dummystring(v,:));
	yearday=dir([basepath filesep cruise filesep 'rois' filesep vpr]);
	yeardayarray=str2mat(yearday.name);
	sz=size(yeardayarray,1);
	if sz>2,
        yeardayarray=sortrows(yeardayarray(3:sz,:));
        yeardayarray=str2mat('Select',yeardayarray);
        h1 = uicontrol('Parent',h, ...  
            'Units','normalized', ...
            'BackgroundColor',[1 1 1], ...
            'Callback','PLCNNmenu GetHour', ...
            'ListboxTop',0, ...
            'Position',[0.5 0.21 0.351 0.053], ...
            'String',yeardayarray, ...
            'fontunits','normalized','fontsize',.4, ...
            'FontWeight','normal', ...
            'max',sz+1, ...
            'min',1, ...
            'Style','popupmenu', ...
            'Tag','PopupMenu Yearday', ...
            'TooltipString','Select Yearday', ...
            'Value',1);
	end
end


function GetHour(fig)
if nargin<1,
	h=gcbf;
else
	h=fig;
end;
if ~isempty(h)
	%Delete existing Hour popup and start pushbutton
	h1=findobj(h,'Tag','PopupMenu Hour'); delete(h1);
    h1=findobj(h,'Tag','PushButton Classify Hour'); delete(h1);
	%Get Hours
	h1=findobj(h,'Tag','PopupMenu ROI Drive');
	dummystring=get(h1,'String');v=get(h1,'value');
	disc=deblank(dummystring(v,:));
	h1=findobj(h,'Tag','PopupMenu ROI Folder');
	dummystring=get(h1,'String');v=get(h1,'value');
	folder=deblank(dummystring(v,:));
	basepath=[disc folder];
	h1=findobj(h,'Tag','PopupMenu Cruise');
	dummystring=get(h1,'String');v=get(h1,'value');
	cruise=deblank(dummystring(v,:));
	h1=findobj(h,'Tag','PopupMenu VPR Number');
	dummystring=get(h1,'String');v=get(h1,'value');
	vpr=deblank(dummystring(v,:));
	h1=findobj(h,'Tag','PopupMenu Yearday');
	dummystring=get(h1,'String');v=get(h1,'value');
	yearday=deblank(dummystring(v,:));
	hours=dir([basepath filesep cruise filesep 'rois' filesep vpr filesep yearday]);
	hourarray=str2mat(hours.name);
	sz=size(hourarray,1);
	if sz>2,
        hourarray=sortrows(hourarray(3:sz,:));
        if size(hourarray,2)>3,hourarray=str2mat('Select',hourarray(isspace(hourarray(:,4)),:));
        else,hourarray=str2mat('Select',hourarray);end
        h1 = uicontrol('Parent',h, ...  
            'Units','normalized', ...
            'BackgroundColor',[1 1 1], ...
            'Callback','PLCNNmenu GetHourButton', ...
            'ListboxTop',0, ...
            'Position',[0.5 0.15 0.351 0.053], ...
            'String',hourarray, ...
            'fontunits','normalized','fontsize',.4, ...
            'FontWeight','normal', ...
            'max',sz+1, ...
            'min',1, ...
            'Style','popupmenu', ...
            'Tag','PopupMenu Hour', ...
            'TooltipString','Select Hour', ...
            'Value',1);
    end
end

function GetHourButton(fig)
if nargin<1,
	h=gcbf;
else
	h=fig;
end;
if ~isempty(h)
    %Create Classify Underway Button
	h1 = uicontrol('Parent',h, ...  
        'Units','normalized', ...
        'BackgroundColor',[0.2157 .6353 .6353]*1.2*1.1, ...
        'Callback','CNNClassify(''h'')', ...
        'Position',[0.293 0.095 0.429 0.050], ...
        'String','Classify Hour', ...
        'fontunits','normalized','fontsize',.528, ...
        'FontWeight','normal', ...
        'Style','pushbutton', ...
        'Tag','PushButton Classify Hour', ...
        'TooltipString','Push to classify a specific hour');
end