VMT

PURPOSE ^

--- THE VELOCITY MAPPING TOOLBOX ---

SYNOPSIS ^

function varargout = VMT(varargin)

DESCRIPTION ^

 --- THE VELOCITY MAPPING TOOLBOX ---
 
 VMT is a Matlab-based software for processing and visualizing ADCP data
 collected along transects in rivers or other bodies of water. VMT allows
 rapid processing, visualization, and analysis of a range of ADCP datasets
 and includes utilities to export ADCP data to files compatible with
 ArcGIS, Tecplot, and Google Earth. The software can be used to explore
 patterns of three-dimensional fluid motion through several methods for
 calculation of secondary flows (e.g. Rhoads and Kenworthy, 1998; Lane et
 al., 2000). The software also includes capabilities for analyzing the
 acoustic backscatter and bathymetric data from the ADCP. A user-friendly
 graphical user interface (GUI) enhances program functionality and
 provides ready access to two- and three- dimensional plotting functions,
 allowing rapid display and interrogation of velocity, backscatter, and
 bathymetry data.
 
 CITATION: 
 Parsons, D. R., Jackson, P. R., Czuba, J. A., Engel, F. L., Rhoads, B.
 L., Oberg, K. A., Best, J. L., Mueller, D. S., Johnson, K. K. and Riley,
 J. D. (2013), Velocity Mapping Toolbox (VMT): a processing and
 visualization suite for moving-vessel ADCP measurements. Earth Surf.
 Process. Landforms. doi: 10.1002/esp.3367

__________________________________________________________________________
 P.R. Jackson, U.S. Geological Survey, Illinois Water Science Center
 (pjackson@usgs.gov)

 Code contributed by D. Parsons, D. Mueller, J. Czuba, and F. Engel.
__________________________________________________________________________

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = VMT(varargin)
0002 % --- THE VELOCITY MAPPING TOOLBOX ---
0003 %
0004 % VMT is a Matlab-based software for processing and visualizing ADCP data
0005 % collected along transects in rivers or other bodies of water. VMT allows
0006 % rapid processing, visualization, and analysis of a range of ADCP datasets
0007 % and includes utilities to export ADCP data to files compatible with
0008 % ArcGIS, Tecplot, and Google Earth. The software can be used to explore
0009 % patterns of three-dimensional fluid motion through several methods for
0010 % calculation of secondary flows (e.g. Rhoads and Kenworthy, 1998; Lane et
0011 % al., 2000). The software also includes capabilities for analyzing the
0012 % acoustic backscatter and bathymetric data from the ADCP. A user-friendly
0013 % graphical user interface (GUI) enhances program functionality and
0014 % provides ready access to two- and three- dimensional plotting functions,
0015 % allowing rapid display and interrogation of velocity, backscatter, and
0016 % bathymetry data.
0017 %
0018 % CITATION:
0019 % Parsons, D. R., Jackson, P. R., Czuba, J. A., Engel, F. L., Rhoads, B.
0020 % L., Oberg, K. A., Best, J. L., Mueller, D. S., Johnson, K. K. and Riley,
0021 % J. D. (2013), Velocity Mapping Toolbox (VMT): a processing and
0022 % visualization suite for moving-vessel ADCP measurements. Earth Surf.
0023 % Process. Landforms. doi: 10.1002/esp.3367
0024 %
0025 %__________________________________________________________________________
0026 % P.R. Jackson, U.S. Geological Survey, Illinois Water Science Center
0027 % (pjackson@usgs.gov)
0028 %
0029 % Code contributed by D. Parsons, D. Mueller, J. Czuba, and F. Engel.
0030 %__________________________________________________________________________
0031 
0032 % Begin initialization code - DO NOT EDIT
0033 gui_Singleton = 1;
0034 gui_State = struct('gui_Name',       mfilename, ...
0035     'gui_Singleton',  gui_Singleton, ...
0036     'gui_OpeningFcn', @VMT_OpeningFcn, ...
0037     'gui_OutputFcn',  @VMT_OutputFcn, ...
0038     'gui_LayoutFcn',  [] , ...
0039     'gui_Callback',   []);
0040 if nargin && ischar(varargin{1})
0041     gui_State.gui_Callback = str2func(varargin{1});
0042 end
0043 
0044 % If ERROR, write a txt file with the error dump info
0045 try
0046 if nargout
0047     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0048 else
0049     gui_mainfcn(gui_State, varargin{:});
0050 end
0051 
0052 catch err
0053     if isdeployed
0054         errLogFileName = fullfile(pwd,...
0055             ['errorLog' datestr(now,'yyyymmddHHMMSS') '.txt']);
0056         msgbox({['An unexpected error occurred. Error code: ' err.identifier];...
0057             ['Error details are being written to the following file: '];...
0058             errLogFileName},...
0059             'VMT Status: Unexpected Error',...
0060             'error');
0061         fid = fopen(errLogFileName,'W');
0062         fwrite(fid,err.getReport('extended','hyperlinks','off'));
0063         fclose(fid);
0064         rethrow(err)
0065     else
0066         msgbox(['An unexpected error occurred. Error code: ' err.identifier],...
0067             'VMT Status: Unexpected Error',...
0068             'error');
0069         rethrow(err);
0070     end
0071 end
0072 % End initialization code - DO NOT EDIT
0073 
0074 %#ok<*DEFNU,*INUSL,*INUSD>
0075 
0076 % --- Executes just before VMT is made visible.
0077 function VMT_OpeningFcn(hObject, eventdata, handles, varargin)
0078 % This function has no output args, see OutputFcn.
0079 % hObject    handle to figure
0080 % eventdata  reserved - to be defined in a future version of MATLAB
0081 % handles    structure with handles and user data (see GUIDATA)
0082 % varargin   command line arguments to VMT (see VARARGIN)
0083 
0084 % Choose default command line output for VMT
0085 handles.output = hObject;
0086 
0087 % Build the GUI toolbar:
0088 % ----------------------
0089 handles = buildToolbar(handles);
0090 
0091 % Ensure path to utils & docs is available
0092 % ----------------------------------------
0093 if ~isdeployed
0094     filesep = '\'; % windows
0095     utilspath = [pwd filesep 'utils'];
0096     docspath  = [pwd filesep 'doc'];
0097     toolspath = [pwd filesep 'tools'];
0098     addpath(utilspath,docspath,toolspath)
0099 end
0100 
0101 % Update handles structure
0102 % ------------------------
0103 guidata(hObject, handles);
0104 
0105 % Load the GUI preferences:
0106 % -------------------------
0107 load_prefs(handles.figure1)
0108 
0109 % Initialize the GUI parameters:
0110 % ------------------------------
0111 guiparams = createGUIparams;
0112 guiparams.vmt_version = 'v4.06';
0113 
0114 % Draw the VMT Background
0115 % -----------------
0116 pos = get(handles.figure1,'position');
0117 axes(handles.VMTBackground);
0118 % if ~isdeployed %isempty(dir(fullfile(matlabroot,'toolbox','images')))
0119     X = imread('VMT_Background.png');
0120     imdisp(X,'size',[pos(4) pos(3)]) % Avoids problems with users not having Image Processing TB
0121 % else
0122 %     X = imread('VMT_Background.png');
0123 %     X = imresize(X, [pos(4) pos(3)]);
0124 %     X = uint8(X);
0125 %     imshow(X,'Border','tight')
0126 % end
0127 uistack(handles.VMTBackground,'bottom')
0128 
0129 % Store the application data:
0130 % ---------------------------
0131 setappdata(handles.figure1,'guiparams',guiparams)
0132 % guiprefs = getappdata(handles.figure1,'guiprefs');
0133 % setappdata(handles.figure1,'guiprefs',guiprefs)
0134 store_prefs(handles.figure1,'runcounter')
0135 
0136 % Auto-check for updates
0137 % ----------------------
0138 thres = 20; 
0139 runcounter = getpref('VMT','runcounter');
0140 time_to_check = (mod(runcounter,thres)==0);
0141 if time_to_check
0142     menuCheckForUpdates_Callback(hObject, eventdata, handles)
0143 end
0144 
0145 % Initialize the GUI:
0146 % -------------------
0147 initGUI(handles)
0148 set_enable(handles,'init')
0149 % set(handles.GraphicsExportPanel,'Visible','off')
0150 % set(handles.ProcessingPanel,'Visible','off')
0151 pos = get(handles.figure1,'Position');
0152 % pos(3) = 545;
0153 % set(handles.figure1,'Position',pos)
0154 movegui(handles.figure1,'center')
0155 set(handles.figure1,'Resize','on')
0156 
0157 % Allow access to the VMT Main GUI info by other sub-GUIs by pushing it to
0158 % the root
0159 setappdata(0  , 'hVMTgui'    , gcf);
0160 
0161 % UIWAIT makes VMT wait for user response (see UIRESUME)
0162 % uiwait(handles.figure1);
0163 % [EOF] VMT_OpeningFcn
0164 
0165 
0166 % --- Outputs from this function are returned to the command line.
0167 function varargout = VMT_OutputFcn(hObject, eventdata, handles)
0168 % varargout  cell array for returning output args (see VARARGOUT);
0169 % hObject    handle to figure
0170 % eventdata  reserved - to be defined in a future version of MATLAB
0171 % handles    structure with handles and user data (see GUIDATA)
0172 
0173 % Get default command line output from handles structure
0174 varargout{1} = handles.output;
0175 % [EOF] VMT_OutputFcn
0176 
0177 % --- Executes when figure1 is resized.
0178 function figure1_ResizeFcn(hObject, eventdata, handles)
0179 
0180 % Draw the VMT Background
0181 % -----------------
0182 pos = get(handles.figure1,'position');
0183 axes(handles.VMTBackground);
0184 % if ~isdeployed %isempty(dir(fullfile(matlabroot,'toolbox','images')))
0185     X = imread('VMT_Background.png');
0186     imdisp(X,'size',[pos(4) pos(3)]) % Avoids problems with users not having Image Processing TB
0187 % else
0188 %     X = imread('VMT_Background.png');
0189 %     X = imresize(X, [pos(4) pos(3)]);
0190 %     X = uint8(X);
0191 %     imshow(X,'Border','tight')
0192 % end
0193 uistack(handles.VMTBackground,'bottom')
0194 
0195 % --- Executes when user attempts to close figure1.
0196 function figure1_CloseRequestFcn(hObject, eventdata, handles)
0197 % hObject    handle to figure1 (see GCBO)
0198 % eventdata  reserved - to be defined in a future version of MATLAB
0199 % handles    structure with handles and user data (see GUIDATA)
0200 
0201 % Hint: delete(hObject) closes the figure
0202 who_called = get(hObject,'tag');
0203 close_button = questdlg(...
0204     'You are about to exit VMT. Any unsaved work will be lost. Are you sure?',...
0205     'Exit VMT?','No');
0206 switch close_button
0207     case 'Yes'
0208         closereq
0209         close all hidden
0210     otherwise
0211         return
0212 end
0213 % [EOF] figure1_CloseRequestFcn
0214 
0215 %%%%%%%%%%%%%%%%%%%%%%
0216 % MENU BAR CALLBACKS %
0217 %%%%%%%%%%%%%%%%%%%%%%
0218 
0219 % --------------------------------------------------------------------
0220 function menuFile_Callback(hObject, eventdata, handles)
0221 % Empty
0222 
0223 % --------------------------------------------------------------------
0224 function menuOpen_Callback(hObject, eventdata, handles)
0225 % Empty
0226 
0227 % --------------------------------------------------------------------
0228 function menuOpenASCII_Callback(hObject, eventdata, handles)
0229 loadDataCallback(hObject, eventdata, handles)
0230 % [EOF] menuOpenASCII_Callback
0231 
0232 % --------------------------------------------------------------------
0233 function menuOpenMAT_Callback(hObject, eventdata, handles)
0234 
0235 % Get the Application data:
0236 % -------------------------
0237 guiparams = getappdata(handles.figure1,'guiparams');
0238 guiprefs = getappdata(handles.figure1,'guiprefs');
0239 
0240 % Ask the user to select files:
0241 % -----------------------------
0242 % current_file = fullfile(guiparams.data_folder,guiparams.data_files{1});
0243 % current_file = fullfile(guiprefs.mat_path,guiprefs.mat_file);
0244 if iscell(guiprefs.mat_file)
0245     uifile = fullfile(guiprefs.mat_path,guiprefs.mat_file{1});
0246 else
0247     uifile = fullfile(guiprefs.mat_path,guiprefs.mat_file);
0248 end
0249 [filename,pathname] = ...
0250     uigetfile({'*.mat','MAT-files (*.mat)'}, ...
0251     'Select MAT File', ...
0252     uifile, 'MultiSelect','on');
0253 
0254 if ischar(filename) % Single MAT file loaded
0255     % Load the data:
0256     % --------------
0257     vars = load(fullfile(pathname,filename));
0258     
0259     % Make sure the selected file is a valid file:
0260     % --------------------------------------------
0261     varnames = fieldnames(vars);
0262     if isequal(sort(varnames),{'A' 'Map' 'V' 'z'}')
0263         guiparams.mat_path = pathname;
0264         guiparams.mat_file = filename;
0265         guiparams.z = vars.z;
0266         guiparams.A = vars.A;
0267         guiparams.V = vars.V;
0268         
0269         % Update the preferences:
0270         % -----------------------
0271         guiprefs = getappdata(handles.figure1,'guiprefs');
0272         guiprefs.mat_path = pathname;
0273         guiprefs.mat_file = filename;
0274         setappdata(handles.figure1,'guiprefs',guiprefs)
0275         store_prefs(handles.figure1,'mat')
0276                      
0277         % Re-store the Application Data:
0278         % ------------------------------
0279         setappdata(handles.figure1,'guiparams',guiparams)
0280         
0281         % Update the GUI:
0282         % ---------------
0283         set(handles.HorizontalGridNodeSpacing,'String',vars.A(1).hgns)
0284         set_enable(handles,'fileloaded')
0285     else % Not a valid file
0286         errordlg('The selected file is not a valid ADCP data MAT file.', ...
0287             'Invalid File...')
0288     end
0289     
0290     % Set the vertical grid node spacing
0291     % ----------------------------------
0292     % For RioGrande probes, use the bin size, else just use the default
0293     % Backwards compatible
0294     if vars.A(1).Sup.wm ~= 3 % RG
0295         set(handles.VerticalGridNodeSpacing,'String',double(vars.A(1).Sup.binSize_cm(1))/100)
0296     else % Older file, must be RG
0297         set(handles.VerticalGridNodeSpacing,'String',0.4)
0298     end
0299     
0300 elseif iscell(filename) % Multiple MAT files loaded
0301     % Set the filenames
0302     % -----------------
0303     guiparams.mat_path = pathname;
0304     guiparams.mat_file = filename;
0305     
0306     % Push status to log window
0307     % -------------------------
0308     log_text = {...
0309         'Loading previously processed MAT files.';...
0310         'Directory:'};
0311     log_text = vertcat(log_text, pathname, {'Files:'}, filename');
0312     statusLogging(handles.LogWindow,log_text)
0313     
0314     % Update the Application Data:
0315     % ------------------------------
0316     setappdata(handles.figure1,'guiparams',guiparams)
0317     
0318     % Update the persistent preferences:
0319     % ----------------------------------
0320     guiprefs = getappdata(handles.figure1,'guiprefs');
0321     guiprefs.mat_path = pathname;
0322     guiprefs.mat_file = filename;
0323     setappdata(handles.figure1,'guiprefs',guiprefs)
0324     store_prefs(handles.figure1,'mat')
0325         
0326     % Update the GUI:
0327     % ---------------
0328     set_enable(handles,'multiplematfiles')
0329 end
0330 
0331 % [EOF] menuOpenMAT_Callback
0332 
0333 % --------------------------------------------------------------------
0334 function menuSave_Callback(hObject, eventdata, handles)
0335 % Empty
0336 
0337 % --------------------------------------------------------------------
0338 function menuSaveMAT_Callback(hObject, eventdata, handles)
0339 saveDataCallback(hObject, eventdata, handles)
0340 % [EOF] menuSaveMAT_Callback
0341 
0342 % --------------------------------------------------------------------
0343 function menuSaveTecplot_Callback(hObject, eventdata, handles)
0344 SaveTecplotFile_Callback(handles,eventdata,handles)
0345 % [EOF] menuSaveTecplot_Callback
0346 
0347 % --------------------------------------------------------------------
0348 function menuSaveKMZFile_Callback(hObject, eventdata, handles)
0349 SaveGoogleEarthFile_Callback(handles,eventdata,handles)
0350 % [EOF] menuSaveKMZFile_Callback
0351 
0352 % --------------------------------------------------------------------
0353 function menuExport_Callback(hObject, eventdata, handles)
0354 % Empty
0355 
0356 % --------------------------------------------------------------------
0357 function menuFigureExportsettings_Callback(hObject, eventdata, handles)
0358 % Empty
0359 
0360 % --------------------------------------------------------------------
0361 function menuPrintFormat_Callback(hObject, eventdata, handles)
0362 
0363 % Get the Application Data:
0364 % -------------------------
0365 guiparams = getappdata(handles.figure1,'guiparams');
0366 
0367 % Update the Application Data:
0368 % ----------------------------
0369 guiparams.print        = true;
0370 guiparams.presentation = false;
0371 
0372 % Re-store the Application data:
0373 % ------------------------------
0374 setappdata(handles.figure1,'guiparams',guiparams)
0375 
0376 % Update the GUI:
0377 % ---------------
0378 set(handles.menuPrintFormat,       'Checked','on')
0379 set(handles.menuPresentationFormat,'Checked','off')
0380 
0381 % [EOF] menuPrintFormat_Callback
0382 
0383 
0384 % --------------------------------------------------------------------
0385 function menuPresentationFormat_Callback(hObject, eventdata, handles)
0386 
0387 % Get the Application Data:
0388 % -------------------------
0389 guiparams = getappdata(handles.figure1,'guiparams');
0390 
0391 % Update the Application Data:
0392 % ----------------------------
0393 guiparams.print        = false;
0394 guiparams.presentation = true;
0395 
0396 % Re-store the Application data:
0397 % ------------------------------
0398 setappdata(handles.figure1,'guiparams',guiparams)
0399 
0400 % Update the GUI:
0401 % ---------------
0402 set(handles.menuPrintFormat,       'Checked','off')
0403 set(handles.menuPresentationFormat,'Checked','on')
0404 
0405 % [EOF] menuPresentationFormat_Callback
0406 
0407 % --------------------------------------------------------------------
0408 function menuGraphicsRenderer_Callback(hObject, eventdata, handles)
0409 %  --- Empty ---
0410 
0411 % --------------------------------------------------------------------
0412 function menuOpenGL_Callback(hObject, eventdata, handles)
0413 % Get the Application Data:
0414 % -------------------------
0415 guiparams = getappdata(handles.figure1,'guiparams');
0416 guiprefs  = getappdata(handles.figure1,'guiprefs');
0417 
0418 % Update the Application Data:
0419 % ----------------------------
0420 guiparams.renderer  = 'OpenGL';
0421 guiprefs.renderer   = 'OpenGL';
0422 
0423 % Re-store the Application data:
0424 % ------------------------------
0425 setappdata(handles.figure1,'guiparams',guiparams)
0426 setappdata(handles.figure1,'guiprefs',guiprefs)
0427 store_prefs(handles.figure1,'renderer')
0428 
0429 % Update the GUI:
0430 % ---------------
0431 set(handles.menuOpenGL,   'Checked','on')
0432 set(handles.menuPainters, 'Checked','off')
0433 set(handles.menuZbuffer,  'Checked','off')
0434 
0435 % Modify the existing figures
0436 % ---------------------------
0437 % Find what plots exist already
0438 hf = findobj('type','figure');
0439 valid_names = {'Plan View Map'; 'Mean Cross Section Contour'};
0440 
0441 % Loop through valid figures and adjust
0442 % -------------------------------------
0443 if ~isempty(hf) &&  any(ishandle(hf))
0444     for i = 1:length(valid_names)
0445         % Focus the figure
0446         hff = findobj('name','Plan View Map');
0447         if ~isempty(hff) &&  ishandle(hff)
0448             figure(hff)
0449             set(hff,'Renderer',guiparams.renderer)
0450         end
0451         hff = findobj('name','Mean Cross Section Contour');
0452         if ~isempty(hff) &&  ishandle(hff)
0453             figure(hff)
0454             set(hff,'Renderer',guiparams.renderer)
0455         end
0456     end
0457 end
0458 % [EOF] menuOpenGL_Callback
0459 
0460 
0461 % --------------------------------------------------------------------
0462 function menuPainters_Callback(hObject, eventdata, handles)
0463 % Get the Application Data:
0464 % -------------------------
0465 guiparams = getappdata(handles.figure1,'guiparams');
0466 guiprefs  = getappdata(handles.figure1,'guiprefs');
0467 
0468 % Update the Application Data:
0469 % ----------------------------
0470 guiparams.renderer  = 'painters';
0471 guiprefs.renderer   = 'painters';
0472 
0473 % Re-store the Application data:
0474 % ------------------------------
0475 setappdata(handles.figure1,'guiparams',guiparams)
0476 setappdata(handles.figure1,'guiprefs',guiprefs)
0477 store_prefs(handles.figure1,'renderer')
0478 
0479 % Update the GUI:
0480 % ---------------
0481 set(handles.menuOpenGL,   'Checked','off')
0482 set(handles.menuPainters, 'Checked','on')
0483 set(handles.menuZbuffer,  'Checked','off')
0484 
0485 % Modify the existing figures
0486 % ---------------------------
0487 % Find what plots exist already
0488 hf = findobj('type','figure');
0489 valid_names = {'Plan View Map'; 'Mean Cross Section Contour'};
0490 
0491 % Loop through valid figures and adjust
0492 % -------------------------------------
0493 if ~isempty(hf) &&  any(ishandle(hf))
0494     for i = 1:length(valid_names)
0495         % Focus the figure
0496         hff = findobj('name','Plan View Map');
0497         if ~isempty(hff) &&  ishandle(hff)
0498             figure(hff)
0499             set(hff,'Renderer',guiparams.renderer)
0500         end
0501         hff = findobj('name','Mean Cross Section Contour');
0502         if ~isempty(hff) &&  ishandle(hff)
0503             figure(hff)
0504             set(hff,'Renderer',guiparams.renderer)
0505         end
0506     end
0507 end
0508 % [EOF] menuPainters_Callback
0509 
0510 % --------------------------------------------------------------------
0511 function menuZbuffer_Callback(hObject, eventdata, handles)
0512 % Get the Application Data:
0513 % -------------------------
0514 guiparams = getappdata(handles.figure1,'guiparams');
0515 guiprefs  = getappdata(handles.figure1,'guiprefs');
0516 
0517 % Update the Application Data:
0518 % ----------------------------
0519 guiparams.renderer  = 'zbuffer';
0520 guiprefs.renderer   = 'zbuffer';
0521 
0522 % Re-store the Application data:
0523 % ------------------------------
0524 setappdata(handles.figure1,'guiparams',guiparams)
0525 setappdata(handles.figure1,'guiprefs',guiprefs)
0526 store_prefs(handles.figure1,'renderer')
0527 
0528 % Update the GUI:
0529 % ---------------
0530 set(handles.menuOpenGL,   'Checked','off')
0531 set(handles.menuPainters, 'Checked','off')
0532 set(handles.menuZbuffer,  'Checked','on')
0533 
0534 % Modify the existing figures
0535 % ---------------------------
0536 % Find what plots exist already
0537 hf = findobj('type','figure');
0538 valid_names = {'Plan View Map'; 'Mean Cross Section Contour'};
0539 
0540 % Loop through valid figures and adjust
0541 % -------------------------------------
0542 if ~isempty(hf) &&  any(ishandle(hf))
0543     for i = 1:length(valid_names)
0544         % Focus the figure
0545         hff = findobj('name','Plan View Map');
0546         if ~isempty(hff) &&  ishandle(hff)
0547             figure(hff)
0548             set(hff,'Renderer',guiparams.renderer)
0549         end
0550         hff = findobj('name','Mean Cross Section Contour');
0551         if ~isempty(hff) &&  ishandle(hff)
0552             figure(hff)
0553             set(hff,'Renderer',guiparams.renderer)
0554         end
0555     end
0556 end
0557 % [EOF] menuZbuffer_Callback
0558 
0559 % --------------------------------------------------------------------
0560 function menuExportFigures_Callback(hObject, eventdata, handles)
0561 % Get the Application data:
0562 % -------------------------
0563 guiparams = getappdata(handles.figure1,'guiparams');
0564 guiprefs  = getappdata(handles.figure1,'guiprefs');
0565 
0566 % Find what plots exist already
0567 fig_handles = findobj('type','figure');
0568 fig_names   = get(fig_handles,'name');
0569 
0570 % Remove the VMT GUI as a valid figure in the list
0571 [~, idx] = ismember({get(handles.figure1,'Name'),'VMT_GraphicsControl'}, fig_names);
0572 if ~isempty(idx)
0573     fig_names(idx) = [];
0574 end
0575 
0576 if guiparams.presentation
0577     figure_style = 'presentation';
0578 else
0579     figure_style = 'print';
0580 end
0581 
0582 [selected_figures] = openFiguresDialog(fig_names,handles.figure1);
0583 
0584 if isempty(selected_figures) % User pressed cancel
0585     return
0586 else
0587     for i = 1:length(selected_figures)
0588         VMT_SaveFigs(guiprefs.mat_path,selected_figures(i),figure_style)
0589     end
0590 end
0591 
0592 
0593 % [EOF] menuExportFigures_Callback
0594 
0595 % --------------------------------------------------------------------
0596 function menuBathymetryExportSettings_Callback(hObject, eventdata, handles)
0597 % Get the Application data:
0598 % -------------------------
0599 guiparams              = getappdata(handles.figure1,'guiparams');
0600 beam_angle             = guiparams.beam_angle; 
0601 magnetic_variation     = guiparams.magnetic_variation; 
0602 wse                    = guiparams.wse;
0603 output_auxiliary_data  = guiparams.output_auxiliary_data; 
0604 
0605 % Open dialog and allow user to select settings
0606 % ---------------------------------------------
0607 [beam_angle,...
0608     magnetic_variation,...
0609     wse,...
0610     output_auxiliary_data] = ...
0611     exportSettingsDialog(beam_angle,magnetic_variation,wse,output_auxiliary_data,handles.figure1);
0612 
0613 % Re-store the Application data:
0614 % ------------------------------
0615 guiparams.beam_angle            = beam_angle;
0616 guiparams.magnetic_variation    = magnetic_variation; 
0617 guiparams.wse                   = wse;
0618 guiparams.output_auxiliary_data = output_auxiliary_data;
0619 setappdata(handles.figure1,'guiparams',guiparams)
0620 
0621 % [EOF] menuExportSettings_Callback
0622 
0623 % --------------------------------------------------------------------
0624 function menuExportMultibeamBathymetry_Callback(hObject, eventdata, handles)
0625 ExportMultibeamBathymetry_Callback(hObject, eventdata, handles);
0626 % [EOF] menuExportMultibeamBathymetry_Callback
0627 
0628 
0629 % --------------------------------------------------------------------
0630 function menuSaveANVFile_Callback(hObject, eventdata, handles)
0631 
0632 % Get the Application Data:
0633 % -------------------------
0634 guiparams = getappdata(handles.figure1,'guiparams');
0635 guiprefs  = getappdata(handles.figure1,'guiprefs');
0636 PVdata    = guiparams.iric_anv_planview_data;
0637 iric_path = guiprefs.iric_path;
0638 iric_file = guiprefs.iric_file;
0639 
0640 % Is there any planview data?
0641 if isempty(PVdata)
0642     % Nothing to do, warn user
0643     log_text = {'No planview plot data to export. User must Plot Plan View first.'};
0644     warndlg(log_text{:},'Nothing to export')
0645 else
0646     % Save the planview data as output and to an *.anv file with spacing
0647     % and smoothing (for iRiC)
0648     log_text = {'Exporting iRic formated ANV vector file...'};
0649     [iric_file,iric_path] = uiputfile('*.anv','Save *.anv file',...
0650         fullfile(iric_path,iric_file));
0651     
0652     if ischar(iric_path) % The user did not hit "Cancel"
0653         outfile = fullfile(iric_path,iric_file);
0654         log_text = vertcat(log_text,{outfile});
0655         ofid   = fopen(outfile, 'wt');
0656         outcount = fprintf(ofid,...
0657             '%8.2f  %8.2f  %5.2f  %3.3f  %3.3f\n',PVdata.outmat);
0658         fclose(ofid);
0659     else
0660         % Return default iric_path and iric_file
0661         iric_path = guiprefs.iric_path;
0662         iric_file = guiprefs.iric_file;
0663     end
0664 end
0665 
0666 % Push messages to Log Window:
0667 % ----------------------------
0668 statusLogging(handles.LogWindow, log_text)
0669 
0670 % Store the persistent preferences:
0671 % ---------------------------------
0672 guiprefs.iric_file = iric_file;
0673 guiprefs.iric_path = iric_path;
0674 setappdata(handles.figure1,'guiprefs',guiprefs)
0675 store_prefs(handles.figure1,'iric')
0676 
0677 % [EOF] menuSaveANVFile_Callback
0678 
0679 % --------------------------------------------------------------------
0680 function menuSaveExcel_Callback(hObject, eventdata, handles)
0681 % Get the Application Data:
0682 % -------------------------
0683 guiparams   = getappdata(handles.figure1,'guiparams');
0684 guiprefs    = getappdata(handles.figure1,'guiprefs');
0685 excel_path  = guiprefs.excel_path;
0686 excel_file  = guiprefs.excel_file;
0687 
0688 % Push messages to Log Window:
0689 % ----------------------------
0690 log_text = {'Exporting Excel File (reprocessing dataset; this will create new plots)'};
0691 statusLogging(handles.LogWindow, log_text)
0692 
0693 % If there are multiple MAT files loaded, go ahead and export just the DAV
0694 % data.
0695 if iscell(guiparams.mat_file)
0696     % Force VMT to reprocess before outputing Excel
0697     planviewPlotCallback(hObject, eventdata, handles)
0698     % Refresh the Application Data:
0699     guiparams   = getappdata(handles.figure1,'guiparams');
0700     z           = guiparams.z;
0701     A           = guiparams.A;
0702     V           = guiparams.V;
0703     Map         = guiparams.Map;
0704     wse         = guiparams.wse;
0705     PVdata      = guiparams.iric_anv_planview_data;
0706     log_text = {'Writing data to Excel file...';...
0707         'Multiple transected loaded. Will export Planview Data Only!'};
0708     [excel_file,excel_path] = uiputfile('*.xlsx','Save *.xlsx file',...
0709         fullfile(excel_path,excel_file));
0710     
0711     if ischar(excel_path) % The user did not hit "Cancel"
0712         outfile = fullfile(excel_path,excel_file);
0713         %log_text = vertcat(log_text,{outfile});
0714         
0715     else
0716         % Return default excel_path and excel_file
0717         excel_path = guiprefs.excel_path;
0718         excel_file = guiprefs.excel_file;
0719         outfile = fullfile(excel_path,excel_file);
0720         %log_text = vertcat(log_text,{outfile});
0721     end
0722     
0723     % Delete the old file if it exists
0724     if exist(outfile, 'file') == 2
0725         log_text = vertcat(log_text,{'Warning: The file';...
0726             ['   ' outfile];...
0727             'already exists. Overwriting file...'});
0728         delete(outfile)
0729     end
0730     
0731     % Save DAV data to an Excel File
0732     hwait = waitbar(0,'Exporting Excel File...');
0733     vmin = num2str(guiparams.depth_range_min);
0734     vmax = num2str(guiparams.depth_range_max);
0735     pvheaders = {...
0736         'UTM_East' 'UTM_North' 'Dist_m' 'Bed_Elev_m'...
0737         ['EastDAV_cm/s, dpth rng ' vmin ' to ' vmax ' m']...
0738         ['NorthDAV_cm/s, dpth rng ' vmin ' to ' vmax ' m']...
0739         'Vel_mag_cm/s' 'Vel_dir_deg'};
0740     
0741 
0742     % Initialize Variables
0743     pvdata = []; Dist = [];
0744     X = []; Y = []; E = [];
0745     Ve = []; Vn =[]; Vm = []; Vd = [];
0746     
0747     % Concatenate data from all MAT files into arrays
0748     for i = 1:length(guiparams.mat_file)
0749         % Load current MAT-file
0750         load(fullfile(guiparams.mat_path, guiparams.mat_file{i}))
0751         
0752         % Location and Bathy
0753         X = [X V.mcsX(1,:)];
0754         Y = [Y V.mcsY(1,:)];
0755         Dist = [Dist sort(V.mcsDist(1,:),'descend')];
0756         E = [E V.mcsBedElev];
0757         
0758         % Build layer-averaged velocities
0759         indx = find(V.mcsDepth(:,1) < str2num(vmin) | V.mcsDepth(:,1) > str2num(vmax));
0760         V.mcsX(indx,:) = nan;
0761         V.mcsY(indx,:) = nan;
0762         V.mcsEast(indx,:) = nan;
0763         V.mcsNorth(indx,:) = nan;
0764         Ve = [Ve VMT_LayerAveMean(V.mcsDepth,V.mcsEast)];
0765         Vn = [Vn VMT_LayerAveMean(V.mcsDepth,V.mcsNorth)];
0766         Vm = [Vm sqrt(VMT_LayerAveMean(V.mcsDepth,V.mcsEast).^2 + VMT_LayerAveMean(V.mcsDepth,V.mcsNorth).^2)];
0767         Vd = [Vd ari2geodeg(atan2(VMT_LayerAveMean(V.mcsDepth,V.mcsNorth),VMT_LayerAveMean(V.mcsDepth,V.mcsEast))*180/pi)];
0768         
0769         waitbar(i/(length(guiparams.mat_file)+1),hwait)
0770     end
0771     
0772     % Put output into 1 matrix
0773     pvdata = [...
0774         X; Y; Dist; E;... % Bathy and locations
0775         Ve; Vn; Vm; Vd... % Velocity
0776         ];
0777     pvdata(isnan(pvdata)) = -9999;
0778     
0779     % Create table and write to Excel
0780     pvout = num2cell(pvdata');
0781     pvout = vertcat(pvheaders,pvout);
0782     xlswrite(outfile,pvout,'Planview');
0783     
0784     % Close out waitbar
0785     waitbar(1,hwait)
0786     delete(hwait)
0787     
0788     % Push messages to Log Window:
0789     % ----------------------------
0790     statusLogging(handles.LogWindow, log_text)
0791 else
0792     
0793     % Force VMT to reprocess before outputing Excel
0794     planviewPlotCallback(hObject, eventdata, handles)
0795     crosssectionPlotCallback(hObject, eventdata, handles)
0796     % Refresh the Application Data:
0797     guiparams   = getappdata(handles.figure1,'guiparams');
0798     z           = guiparams.z;
0799     A           = guiparams.A;
0800     V           = guiparams.V;
0801     Map         = guiparams.Map;
0802     wse         = guiparams.wse;
0803     PVdata      = guiparams.iric_anv_planview_data;
0804     
0805     
0806     log_text = {'Writing data to Excel file...'};
0807     [excel_file,excel_path] = uiputfile('*.xlsx','Save *.xlsx file',...
0808         fullfile(excel_path,excel_file));
0809     
0810     if ischar(excel_path) % The user did not hit "Cancel"
0811         outfile = fullfile(excel_path,excel_file);
0812         %log_text = vertcat(log_text,{outfile});
0813         
0814         % Delete the old file if it exists
0815         if exist(outfile, 'file') == 2
0816             log_text = vertcat(log_text,{'Warning: The file';...
0817                 ['   ' outfile];...
0818                 'already exists. Overwriting file...'});
0819             delete(outfile)
0820         end
0821         
0822         % Push messages to Log Window:
0823         % ----------------------------
0824         statusLogging(handles.LogWindow, log_text)
0825         
0826         % Save MCS Summary to an Excel File
0827         hwait = waitbar(0,'Exporting Excel File...');
0828         xlswrite(outfile,{'Files:'},'VMTSummary','H4'); waitbar(1/5,hwait)
0829         sout = guiparams.data_files';
0830         xlswrite(outfile,sout,'VMTSummary','I4'); waitbar(2/5,hwait)
0831         sout = {...
0832             'VMT: Summary of Mean Cross Section' '' '' '' '' '';...
0833             'VMT ' guiparams.vmt_version '' '' '' '';...
0834             'Date Processed: ' datestr(now) '' '' '' '';...
0835             '' '' '' '' '' '';...
0836             'Mean Cross Section (MCS) Properties' '' '' '' '' '';...
0837             'Horz. Grid Node Spacing (m):' '' '' '' '' guiparams.horizontal_grid_node_spacing;...
0838             'Vert. Grid Node Spacing (m):' '' '' '' '' single(guiparams.A(1).Sup.binSize_cm)/100;...
0839             'Endpoints:' '' '' '' 'UTM_East'    'UTM_North';...
0840             'Left Bank'    '' '' ''    V.xLeftBank V.yLeftBank;...
0841             'Right Bank'    '' '' ''    V.xRightBank V.yRightBank;...
0842             'Total Length in meters' '' '' '' '' V.dl;...
0843             '' '' '' '' '' '';...
0844             'Mean Flow Direction (deg)' '' '' '' '' V.mfd;...
0845             'in geographic coordinates' '' '' '' '' '';...
0846             '' '' '' '' '' '';...
0847             'Slope'    '' '' '' '' V.m;...
0848             'Intercept'    '' '' '' '' V.b;...
0849             'Theta (deg)'    '' '' '' '' V.theta};
0850         xlswrite(outfile,sout,'VMTSummary','A1'); waitbar(3/5,hwait)
0851         
0852         % Save DAV data to an Excel File
0853         vmin = num2str(guiparams.depth_range_min);
0854         vmax = num2str(guiparams.depth_range_max);
0855         pvheaders = {...
0856             'UTM_East_WGS84' 'UTM_North_WGS84' 'Dist_m' 'Bed_Elev_m'...
0857             ['EastDAV_cms_dpthrng_' vmin '_to_' vmax 'm']...
0858             ['NorthDAV_cms_dpthrng_' vmin '_to_' vmax 'm']...
0859             'Vel_mag_cms' 'Vel_dir_deg'};
0860         
0861         % Create block style matrix of all processed data
0862         pvdata = [];
0863         
0864         % Sort the Distances such that when plotting in 2D (Dist. vs. Depth),
0865         % you are looking upstream into the transect
0866         Dist = sort(V.mcsDist,2,'descend');
0867         
0868         % Build bathy data matrix
0869         pvdata = [V.mcsX(1,:); V.mcsY(1,:); Dist(1,:); V.mcsBedElev];
0870         
0871         % Build layer-averaged velocities
0872         indx = find(V.mcsDepth(:,1) < str2num(vmin) | V.mcsDepth(:,1) > str2num(vmax));
0873         V.mcsX(indx,:) = nan;
0874         V.mcsY(indx,:) = nan;
0875         V.mcsEast(indx,:) = nan;
0876         V.mcsNorth(indx,:) = nan;
0877         pvdata = [...
0878             pvdata;...
0879             VMT_LayerAveMean(V.mcsDepth,V.mcsEast);...
0880             VMT_LayerAveMean(V.mcsDepth,V.mcsNorth);...
0881             sqrt(VMT_LayerAveMean(V.mcsDepth,V.mcsEast).^2 + VMT_LayerAveMean(V.mcsDepth,V.mcsNorth).^2);...
0882             ari2geodeg(atan2(VMT_LayerAveMean(V.mcsDepth,V.mcsNorth), VMT_LayerAveMean(V.mcsDepth,V.mcsEast))*180/pi)];
0883         pvdata(isnan(pvdata)) = -9999;
0884         pvout = num2cell(pvdata');
0885         pvout = vertcat(pvheaders,pvout);
0886         xlswrite(outfile,pvout,'Planview');
0887         waitbar(4/5,hwait)
0888         
0889         % Save MCS data to an Excel File
0890         mcsheaders = {...
0891             'UTM_East' ...
0892             'UTM_North'...
0893             'Distance from Left Bank, in meters'...
0894             'Elevation, in meters'...
0895             ...'Bed Elevation, in meters'...
0896             'East Velocity, in cm/s'...
0897             'North Velocity, in cm/s'...
0898             'Vertical Velocity, in cm/s'...
0899             'Velocity Magnitude, in cm/s'...
0900             'Velocity Direction, in degrees (geographic coordinates)'...
0901             'Streamwise Velocity, in cm/s'...
0902             'Transverse Velocity, in cm/s'...
0903             'Primary Velocity (zsd), in cm/s'...
0904             'Secondary Velocity (zsd), in cm/s'...
0905             'Primary Velocity (roz), in cm/s'...
0906             'Secondary Velocity (roz), in cm/s'};
0907         
0908         mcsdata = [...
0909             V.mcsX(:)...
0910             V.mcsY(:)...
0911             V.mcsDist(:)...
0912             (wse - V.mcsDepth(:))...
0913             ...repmat((wse - V.mcsBed(:)),size(V.mcsX,1),1)...
0914             V.mcsEast(:)...
0915             V.mcsNorth(:)...
0916             V.mcsVert(:)...
0917             V.mcsMag(:)...
0918             V.mcsDir(:)...
0919             V.u(:)...
0920             V.v(:)...
0921             V.vp(:)...
0922             V.vs(:)...
0923             V.Roz.up(:)...
0924             V.Roz.us(:)];
0925         mcsdata(isnan(mcsdata)) = -9999;
0926         
0927         mcsout = vertcat(mcsheaders,num2cell(mcsdata));
0928         xlswrite(outfile,mcsout,'MeanCrossSection');
0929         waitbar(1,hwait)
0930         delete(hwait)
0931         
0932     else
0933         % Return default excel_path and excel_file
0934         excel_path = guiprefs.excel_path;
0935         excel_file = guiprefs.excel_file;
0936         outfile = fullfile(excel_path,excel_file);
0937         log_text = {'User aborted Excel export...'};
0938     end
0939     
0940     
0941     
0942 end
0943 
0944 % Push messages to Log Window:
0945 % ----------------------------
0946 statusLogging(handles.LogWindow, log_text)
0947 
0948 % Store the persistent preferences:
0949 % ---------------------------------
0950 guiprefs.excel_file = excel_file;
0951 guiprefs.excel_path = excel_path;
0952 setappdata(handles.figure1,'guiprefs',guiprefs)
0953 store_prefs(handles.figure1,'excel')
0954 
0955 % [EOF] menuSaveExcel_Callback
0956 
0957 % --------------------------------------------------------------------
0958 function menuParameters_Callback(hObject, eventdata, handles)
0959 % Empty
0960 
0961 % --------------------------------------------------------------------
0962 function menuProcessingParameters_Callback(hObject, eventdata, handles)
0963 % Empty
0964 
0965 % --------------------------------------------------------------------
0966 function menuUnitDischargeCorrection_Callback(hObject, eventdata, handles)
0967 % Turn ON or OFF Unit Discharge Correction
0968 
0969 % Get the Application Data:
0970 % -------------------------
0971 guiparams = getappdata(handles.figure1,'guiparams');
0972 
0973 % Update the GUI & Application Data:
0974 % ----------------------------------
0975 status = get(handles.menuUnitDischargeCorrection,'Checked');
0976 switch status
0977     case 'on' % Turn it off
0978         set(handles.menuUnitDischargeCorrection, 'Checked','off')
0979         guiparams.unit_discharge_correction = false;
0980     case 'off' % Turn it on
0981         set(handles.menuUnitDischargeCorrection, 'Checked','on')
0982         guiparams.unit_discharge_correction = true;
0983 end
0984 
0985 % Re-store the Application data:
0986 % ------------------------------
0987 setappdata(handles.figure1,'guiparams',guiparams)
0988 
0989 
0990 %  [EOF] menuUnitDischargeCorrection_Callback
0991 
0992 % --------------------------------------------------------------------
0993 function menuPlottingParameters_Callback(hObject, eventdata, handles)
0994 % Empty
0995 
0996 % --------------------------------------------------------------------
0997 function menuUnits_Callback(hObject, eventdata, handles)
0998 % Empty
0999 
1000 % --------------------------------------------------------------------
1001 function menuMetric_Callback(hObject, eventdata, handles)
1002 % Set the Plotting Parameter Units to "metric"
1003 
1004 % Get the Application Data:
1005 % -------------------------
1006 guiparams = getappdata(handles.figure1,'guiparams');
1007 guiprefs  = getappdata(handles.figure1,'guiprefs');
1008 
1009 % Update the Application Data:
1010 % ----------------------------
1011 guiparams.english_units = false;
1012 guiprefs.units = 'metric';
1013 
1014 % Re-store the Application data:
1015 % ------------------------------
1016 setappdata(handles.figure1,'guiparams',guiparams)
1017 setappdata(handles.figure1,'guiprefs',guiprefs)
1018 store_prefs(handles.figure1,'units')
1019 
1020 % Update the GUI:
1021 % ---------------
1022 set(handles.menuMetric, 'Checked','on')
1023 set(handles.menuEnglish,'Checked','off')
1024 
1025 % [EOF] menuMetric_Callback
1026 
1027 
1028 % --------------------------------------------------------------------
1029 function menuEnglish_Callback(hObject, eventdata, handles)
1030 % Set the Plotting Parameter Units to "english"
1031 
1032 % Get the Application Data:
1033 % -------------------------
1034 guiparams = getappdata(handles.figure1,'guiparams');
1035 guiprefs  = getappdata(handles.figure1,'guiprefs');
1036 
1037 % Update the Application Data:
1038 % ----------------------------
1039 guiparams.english_units = true;
1040 guiprefs.units = 'english';
1041 
1042 % Re-store the Application data:
1043 % ------------------------------
1044 setappdata(handles.figure1,'guiparams',guiparams)
1045 setappdata(handles.figure1,'guiprefs',guiprefs)
1046 store_prefs(handles.figure1,'units')
1047 
1048 % Update the GUI:
1049 % ---------------
1050 set(handles.menuMetric, 'Checked','off')
1051 set(handles.menuEnglish,'Checked','on')
1052 
1053 % [EOF] menuEnglish_Callback
1054 
1055 
1056 % --------------------------------------------------------------------
1057 function menuSetCrossSectionEndpoints_Callback(hObject, eventdata, handles)
1058 % Empty
1059 
1060 % --------------------------------------------------------------------
1061 function menuCrossSectionEndpointAutomatic_Callback(hObject, eventdata, handles)
1062 % Set cross-section endpoints automatically
1063 
1064 % Get the Application Data:
1065 % -------------------------
1066 guiparams = getappdata(handles.figure1,'guiparams');
1067 
1068 % Update the Application Data:
1069 % ----------------------------
1070 guiparams.set_cross_section_endpoints = false;
1071 
1072 % Re-store the Application data:
1073 % ------------------------------
1074 setappdata(handles.figure1,'guiparams',guiparams)
1075 
1076 % Update the GUI:
1077 % ---------------
1078 set(handles.menuCrossSectionEndpointAutomatic, 'Checked','on')
1079 set(handles.menuCrossSectionEndpointManual,    'Checked','off')
1080 
1081 % [EOF] menuCrossSectionEndpointAutomatic_Callback
1082 
1083 
1084 % --------------------------------------------------------------------
1085 function menuCrossSectionEndpointManual_Callback(hObject, eventdata, handles)
1086 % Set cross-section endpoints manually
1087 
1088 % Get the Application Data:
1089 % -------------------------
1090 guiparams = getappdata(handles.figure1,'guiparams');
1091 
1092 % Update the Application Data:
1093 % ----------------------------
1094 guiparams.set_cross_section_endpoints = true;
1095 
1096 % Re-store the Application data:
1097 % ------------------------------
1098 setappdata(handles.figure1,'guiparams',guiparams)
1099 
1100 % Update the GUI:
1101 % ---------------
1102 set(handles.menuCrossSectionEndpointAutomatic, 'Checked','off')
1103 set(handles.menuCrossSectionEndpointManual,    'Checked','on')
1104 
1105 % [EOF] menuCrossSectionEndpointManual_Callback
1106 
1107 
1108 
1109 
1110 % --------------------------------------------------------------------
1111 function menuPlotStyle_Callback(hObject, eventdata, handles)
1112 % Empty
1113 
1114 % --------------------------------------------------------------------
1115 function menuStylePrint_Callback(hObject, eventdata, handles)
1116 
1117 % Get the Application Data:
1118 % -------------------------
1119 guiparams = getappdata(handles.figure1,'guiparams');
1120 
1121 % Update the Application Data:
1122 % ----------------------------
1123 guiparams.print        = true;
1124 guiparams.presentation = false;
1125 
1126 % Re-store the Application data:
1127 % ------------------------------
1128 setappdata(handles.figure1,'guiparams',guiparams)
1129 
1130 % Update the GUI:
1131 % ---------------
1132 set(handles.menuStylePrint,        'Checked','on')
1133 set(handles.menuStylePresentation, 'Checked','off')
1134 set(handles.menuPrintFormat,       'Checked','on')
1135 set(handles.menuPresentationFormat,'Checked','off')
1136 
1137 % Modify the existing figures
1138 % ---------------------------
1139 % Find what plots exist already
1140 hf = findobj('type','figure');
1141 valid_names = {'Plan View Map'; 'Mean Cross Section Contour'};
1142 
1143 % Defaults for Print Stlye Figure
1144 BkgdColor   = 'white';
1145 AxColor     = 'black';
1146 FigColor    = 'white'; % [0.3 0.3 0.3]
1147 FntSize     = 14;
1148 
1149 % Loop through valid figures and adjust
1150 % -------------------------------------
1151 if ~isempty(hf) &&  any(ishandle(hf))
1152     
1153     for i = 1:length(valid_names)
1154         switch valid_names{i}
1155             case 'Plan View Map'
1156                 % Focus the figure
1157                 hff = findobj('name','Plan View Map');
1158                 if ~isempty(hff) &&  ishandle(hff)
1159                     figure(hff)
1160                     
1161                     % Make the changes to figure
1162                     set(gcf,'Color',BkgdColor);
1163                     set(gca,'FontSize',FntSize)
1164                     set(get(gca,'Title'),'FontSize',FntSize)
1165                     set(gca,'Color',FigColor)
1166                     set(gca,'XColor',AxColor)
1167                     set(gca,'YColor',AxColor)
1168                     set(gca,'ZColor',AxColor)
1169                     set(findobj(gcf,'tag','Colorbar'),'FontSize',FntSize,'XColor',AxColor,'YColor',AxColor);
1170                     set(get(gca,'Title'),'FontSize',FntSize,'Color',AxColor)
1171                     set(get(gca,'xLabel'),'FontSize',FntSize,'Color',AxColor)
1172                     set(get(gca,'yLabel'),'FontSize',FntSize,'Color',AxColor)
1173                     
1174                     % Add a text object at the bottom of the figure with
1175                     % the file(s) and path for the data
1176                     ismultiplot = numel(guiparams.mat_file)>1;
1177                     if ~ismultiplot
1178                         filestr = guiparams.savefile;
1179                         wd = length(filestr);
1180                         hd = 1;
1181                     else
1182                         % Construct a filename
1183                         filestr   = [{guiparams.mat_path};guiparams.mat_file'];
1184                         wd        = max(cellfun(@length,filestr));
1185                         hd        = numel(filestr);
1186                             
1187                     end
1188                     
1189                     fileinfotxt = uicontrol('style','text','units','characters');
1190                     disableMenuBar(hff)
1191                     set(fileinfotxt,...
1192                         'string',filestr)
1193                     set(fileinfotxt,...
1194                         'position',[0,0,wd,hd],...
1195                         'Fontsize',FntSize/2,...
1196                         'ForegroundColor',AxColor,...
1197                         'BackgroundColor',BkgdColor,...
1198                         'HorizontalAlignment','Left',...
1199                         'Tag','fileinfotxt',...
1200                         'Visible','off')  % hide this by default, editFigureDialog handles it now)
1201                     
1202                 end
1203             case 'Mean Cross Section Contour'
1204                 % Focus the figure
1205                 hff = findobj('name','Mean Cross Section Contour');
1206                 if ~isempty(hff) &&  ishandle(hff)
1207                     figure(hff)
1208                     
1209                     % Make the changes to figure
1210                     set(gcf,'Color',BkgdColor);
1211                     set(gca,'FontSize',FntSize)
1212                     set(get(gca,'Title'),'FontSize',FntSize)
1213                     set(gca,'Color',FigColor)
1214                     set(gca,'XColor',AxColor)
1215                     set(gca,'YColor',AxColor)
1216                     set(gca,'ZColor',AxColor)
1217                     set(findobj(gcf,'tag','Colorbar'),'FontSize',FntSize,'XColor',AxColor,'YColor',AxColor);
1218                     set(get(gca,'Title'),'FontSize',FntSize,'Color',AxColor)
1219                     set(get(gca,'xLabel'),'FontSize',FntSize,'Color',AxColor)
1220                     set(get(gca,'yLabel'),'FontSize',FntSize,'Color',AxColor)
1221                     set(findobj(gca,'tag','PlotBedElevation')   ,'color'    ,AxColor)
1222                     set(findobj(gca,'tag','ReferenceVectorText'),'color'    ,AxColor)
1223                     
1224                     % Add a text object at the bottom of the figure with
1225                     % the file(s) and path for the data
1226                     ismultiplot = numel(guiparams.mat_file)>1;
1227                     if ~ismultiplot
1228                         filestr = guiparams.savefile;
1229                         wd = length(filestr);
1230                         hd = 1;
1231                     else
1232                         % Construct a filename
1233                         filestr   = [{guiparams.mat_path};guiparams.mat_file'];
1234                         wd        = max(cellfun(@length,filestr));
1235                         hd        = numel(filestr);
1236                             
1237                     end
1238                     
1239                     fileinfotxt = uicontrol('style','text','units','characters');
1240                     disableMenuBar(hff)
1241                     set(fileinfotxt,...
1242                         'string',filestr)
1243                     set(fileinfotxt,...
1244                         'position',[0,0,wd,hd],...
1245                         'Fontsize',FntSize/2,...
1246                         'ForegroundColor',AxColor,...
1247                         'BackgroundColor',BkgdColor,...
1248                         'HorizontalAlignment','Left',...
1249                         'Tag','fileinfotxt',...
1250                         'Visible','off')  % hide this by default, editFigureDialog handles it now
1251                 end
1252             otherwise
1253         end
1254     end
1255     
1256     
1257 end
1258 
1259 
1260 %[EOF] menuStylePrint_Callback
1261 
1262 
1263 % --------------------------------------------------------------------
1264 function menuStylePresentation_Callback(hObject, eventdata, handles)
1265 % Get the Application Data:
1266 % -------------------------
1267 guiparams = getappdata(handles.figure1,'guiparams');
1268 
1269 % Update the Application Data:
1270 % ----------------------------
1271 guiparams.print        = false;
1272 guiparams.presentation = true;
1273 
1274 % Re-store the Application data:
1275 % ------------------------------
1276 setappdata(handles.figure1,'guiparams',guiparams)
1277 
1278 % Update the GUI:
1279 % ---------------
1280 set(handles.menuStylePrint,        'Checked','off')
1281 set(handles.menuStylePresentation, 'Checked','on')
1282 set(handles.menuPrintFormat,       'Checked','off')
1283 set(handles.menuPresentationFormat,'Checked','on')
1284 
1285 % Modify the existing figures
1286 % ---------------------------
1287 % Find what plots exist already
1288 hf = findobj('type','figure');
1289 valid_names = {'Plan View Map'; 'Mean Cross Section Contour'};
1290 
1291 % Defaults for Presentation Stlye Figure
1292 % --------------------------------------
1293 BkgdColor   = 'black';
1294 AxColor     = 'white';
1295 FigColor    = 'black'; % [0.3 0.3 0.3]
1296 FntSize     = 14;
1297 
1298 % Loop through valid figures and adjust
1299 % -------------------------------------
1300 if ~isempty(hf) &&  any(ishandle(hf))
1301     
1302     for i = 1:length(valid_names)
1303         switch valid_names{i}
1304             case 'Plan View Map'
1305                 % Focus the figure
1306                 hff = findobj('name','Plan View Map');
1307                 if ~isempty(hff) &&  ishandle(hff)
1308                     figure(hff)
1309                     
1310                     % Make the changes to figure
1311                     set(gcf,'Color',BkgdColor);
1312                     set(gca,'FontSize',FntSize)
1313                     set(get(gca,'Title'),'FontSize',FntSize)
1314                     set(gca,'Color',FigColor)
1315                     set(gca,'XColor',AxColor)
1316                     set(gca,'YColor',AxColor)
1317                     set(gca,'ZColor',AxColor)
1318                     set(findobj(gcf,'tag','Colorbar'),'FontSize',FntSize,'XColor',AxColor,'YColor',AxColor);
1319                     set(get(gca,'Title'),'FontSize',FntSize,'Color',AxColor)
1320                     set(get(gca,'xLabel'),'FontSize',FntSize,'Color',AxColor)
1321                     set(get(gca,'yLabel'),'FontSize',FntSize,'Color',AxColor)
1322                     
1323                     % Add a text object at the bottom of the figure with
1324                     % the file(s) and path for the data
1325                     ismultiplot = numel(guiparams.mat_file)>1;
1326                     if ~ismultiplot
1327                         filestr = guiparams.savefile;
1328                         wd = length(filestr);
1329                         hd = 1;
1330                     else
1331                         % Construct a filename
1332                         filestr   = [{guiparams.mat_path};guiparams.mat_file'];
1333                         wd        = max(cellfun(@length,filestr));
1334                         hd        = numel(filestr);
1335                             
1336                     end
1337                     
1338                     fileinfotxt = uicontrol('style','text','units','characters');
1339                     disableMenuBar(hff)
1340                     set(fileinfotxt,...
1341                         'string',filestr)
1342                     set(fileinfotxt,...
1343                         'position',[0,0,wd,hd],...
1344                         'Fontsize',FntSize/2,...
1345                         'ForegroundColor',AxColor,...
1346                         'BackgroundColor',BkgdColor,...
1347                         'HorizontalAlignment','Left',...
1348                         'Tag','fileinfotxt',...
1349                         'Visible','off')  % hide this by default, editFigureDialog handles it now)
1350                     
1351                 end
1352             case 'Mean Cross Section Contour'
1353                 % Focus the figure
1354                 hff = findobj('name','Mean Cross Section Contour');
1355                 if ~isempty(hff) &&  ishandle(hff)
1356                     figure(hff)
1357                     
1358                     % Make the changes to figure
1359                     set(gcf,'Color',BkgdColor);
1360                     set(gca,'FontSize',FntSize)
1361                     set(get(gca,'Title'),'FontSize',FntSize)
1362                     set(gca,'Color',[0.3 0.3 0.3]) %FigColor)
1363                     set(gca,'XColor',AxColor)
1364                     set(gca,'YColor',AxColor)
1365                     set(gca,'ZColor',AxColor)
1366                     set(findobj(gcf,'tag','Colorbar'),'FontSize',FntSize,'XColor',AxColor,'YColor',AxColor);
1367                     set(get(gca,'Title'),'FontSize',FntSize,'Color',AxColor)
1368                     set(get(gca,'xLabel'),'FontSize',FntSize,'Color',AxColor)
1369                     set(get(gca,'yLabel'),'FontSize',FntSize,'Color',AxColor)
1370                     set(findobj(gca,'tag','PlotBedElevation')   ,'color'    ,AxColor)
1371                     set(findobj(gca,'tag','ReferenceVectorText'),'color'    ,AxColor)
1372                     
1373                     % Add a text object at the bottom of the figure with
1374                     % the file(s) and path for the data
1375                     ismultiplot = numel(guiparams.mat_file)>1;
1376                     if ~ismultiplot
1377                         filestr = guiparams.savefile;
1378                         wd = length(filestr);
1379                         hd = 1;
1380                     else
1381                         % Construct a filename
1382                         filestr   = [{guiparams.mat_path};guiparams.mat_file'];
1383                         wd        = max(cellfun(@length,filestr));
1384                         hd        = numel(filestr);
1385                             
1386                     end
1387                     
1388                     fileinfotxt = uicontrol('style','text','units','characters');
1389                     disableMenuBar(hff)
1390                     set(fileinfotxt,...
1391                         'string',filestr)
1392                     set(fileinfotxt,...
1393                         'position',[0,0,wd,hd],...
1394                         'Fontsize',FntSize/2,...
1395                         'ForegroundColor',AxColor,...
1396                         'BackgroundColor',BkgdColor,...
1397                         'HorizontalAlignment','Left',...
1398                         'Tag','fileinfotxt',...
1399                         'Visible','off')  % hide this by default, editFigureDialog handles it now
1400                 end
1401             otherwise
1402         end
1403     end
1404     
1405     
1406 end
1407 
1408 % [EOF] menuStylePresentation_Callback
1409 
1410 % --------------------------------------------------------------------
1411 function menuKMZVerticalOffset_Callback(hObject, eventdata, handles)
1412 
1413 % Get the Application data:
1414 % -------------------------
1415 guiparams = getappdata(handles.figure1,'guiparams');
1416 
1417 % Initialize the answer:
1418 % ----------------------
1419 numstr = {num2str(guiparams.vertical_offset)};
1420 answer = NaN;
1421 while isnan(answer)
1422     answer = inputdlg('Vertical Offset (m)','KMZ Export',1,numstr);
1423     
1424     if isempty(answer) % User hits "Cancel"
1425         return
1426     end
1427     
1428     answer = str2double(answer); % A non-numeric char will be NaN
1429     % A numeric char will be a double
1430 end
1431 
1432 % Re-store the Application data:
1433 % ------------------------------
1434 guiparams.vertical_offset = answer;
1435 setappdata(handles.figure1,'guiparams',guiparams)
1436 
1437 % [EOF] menuKMZExport_Callback
1438 
1439 % --------------------------------------------------------------------
1440 function menuBathymetryParameters_Callback(hObject, eventdata, handles)
1441 % Not implemented
1442 
1443 % --------------------------------------------------------------------
1444 function menuTools_Callback(hObject, eventdata, handles)
1445 % Empty
1446 
1447 % --------------------------------------------------------------------
1448 function menuASCII2GIS_Callback(hObject, eventdata, handles)
1449 ASCII2GIS_GUI
1450 % [EOF] menuASCII2GIS_Callback
1451 
1452 % --------------------------------------------------------------------
1453 function menuASCII2KML_Callback(hObject, eventdata, handles)
1454 
1455 % Get the Application preferences:
1456 % --------------------------------
1457 guiprefs  = getappdata(handles.figure1,'guiprefs');
1458 
1459 inpath = guiprefs.kmz_path;
1460 if iscell(guiprefs.kmz_file)
1461     infile = guiprefs.kmz_file{1};
1462 else
1463     infile = guiprefs.kmz_file;
1464 end
1465 [log_text,outpath,outfile] = ASCII2KML(inpath,infile);
1466 
1467 guiprefs.kmz_path = outpath;
1468 guiprefs.kmz_file = outfile;
1469 
1470 % Update persistent preferences
1471 % -----------------------------
1472 setappdata(handles.figure1,'guiprefs',guiprefs)
1473 
1474 % [EOF] menuASCII2KML_Callback
1475 
1476 % --------------------------------------------------------------------
1477 function menuOpenBatchMode_Callback(hObject, eventdata, handles)
1478 % Get the Application preferences:
1479 % --------------------------------
1480 guiprefs  = getappdata(handles.figure1,'guiprefs');
1481 
1482 VMT_BatchMode;
1483 % [EOF] menuOpenBatchMode_Callback
1484 
1485 % --------------------------------------------------------------------
1486 function menuHelp_Callback(hObject, eventdata, handles)
1487 % Empty
1488 
1489 % --------------------------------------------------------------------
1490 function menuUsersGuide_Callback(hObject, eventdata, handles)
1491 guiparams = getappdata(handles.figure1,'guiparams');
1492 try % to open the User Guide PDF
1493     open([pwd filesep 'doc' filesep 'VMT User Guide ' guiparams.vmt_version '.pdf']);
1494     
1495 catch err %#ok<NASGU>
1496     
1497     if isdeployed
1498         errLogFileName = fullfile(pwd,...
1499             ['errorLog' datestr(now,'yyyymmddHHMMSS') '.txt']);
1500         msgbox({['An unexpected error occurred. Error code: ' err.identifier];...
1501             ['Error details are being written to the following file: '];...
1502             errLogFileName},...
1503             'VMT Status: Unexpected Error',...
1504             'error');
1505         fid = fopen(errLogFileName,'W');
1506         fwrite(fid,err.getReport('extended','hyperlinks','off'));
1507         fclose(fid);
1508         rethrow(err)
1509     else
1510         msgbox(['An unexpected error occurred. Error code: ' err.identifier],...
1511             'VMT Status: Unexpected Error',...
1512             'error');
1513         rethrow(err);
1514     end
1515 end
1516 % [EOF] menuASCII2KML_Callback
1517 
1518 % --------------------------------------------------------------------
1519 function menuFunctionLibrary_Callback(hObject, eventdata, handles)
1520 % Get the Application data:
1521 % -------------------------
1522 % guiparams = getappdata(handles.figure1,'guiparams'); %#ok<NASGU>
1523 
1524 try
1525     % Construct a URL to a local file which can be interpreted by any
1526     % web-browser
1527     rootpath = strrep(pwd,filesep,'/');
1528     webaddress = ['file:///' rootpath '/doc/index.html'];
1529     system(['start ' webaddress]);
1530 %     [stat,h,url] = web(webaddress) % Produced with m2html (FEX)
1531 catch err 
1532     if isdeployed
1533         errLogFileName = fullfile(pwd,...
1534             ['errorLog' datestr(now,'yyyymmddHHMMSS') '.txt']);
1535         msgbox({['An unexpected error occurred. Error code: ' err.identifier];...
1536             ['Error details are being written to the following file: '];...
1537             errLogFileName},...
1538             'VMT Status: Unexpected Error',...
1539             'error');
1540         fid = fopen(errLogFileName,'W');
1541         fwrite(fid,err.getReport('extended','hyperlinks','off'));
1542         fclose(fid);
1543         rethrow(err)
1544     else
1545         msgbox(['An unexpected error occurred. Error code: ' err.identifier],...
1546             'VMT Status: Unexpected Error',...
1547             'error');
1548         rethrow(err);
1549     end
1550 end
1551 
1552 % [EOF] menuFunctionLibrary_Callback
1553 
1554 % --------------------------------------------------------------------
1555 function menuCheckForUpdates_Callback(hObject, eventdata, handles)
1556 
1557 % Get the Application data:
1558 % -------------------------
1559 guiparams = getappdata(handles.figure1,'guiparams');
1560 guiprefs  = getappdata(handles.figure1,'guiprefs');
1561 
1562 % Check version tag against the web, and display a message
1563 try
1564     current_vmt_version = urlread('http://hydroacoustics.usgs.gov/movingboat/VMT/VMT_version.txt');
1565     %     current_vmt_version = urlread('http://hydroacoustics.usgs.gov/movingboat/VMT/VMT_version.txt');
1566 catch err %#ok<NASGU>
1567     if isdeployed
1568         errLogFileName = fullfile(pwd,...
1569             ['errorLog' datestr(now,'yyyymmddHHMMSS') '.txt']);
1570         msgbox({['An unexpected error occurred. Error code: ' err.identifier];...
1571             ['Error details are being written to the following file: '];...
1572             errLogFileName},...
1573             'VMT Status: Unexpected Error',...
1574             'error');
1575         fid = fopen(errLogFileName,'W');
1576         fwrite(fid,err.getReport('extended','hyperlinks','off'));
1577         fclose(fid);
1578         rethrow(err)
1579     else
1580         msgbox(['An unexpected error occurred. Error code: ' err.identifier],...
1581             'VMT Status: Unexpected Error',...
1582             'error');
1583         rethrow(err);
1584     end
1585 end
1586 
1587 if strcmpi(guiparams.vmt_version,current_vmt_version)
1588     h = msgbox(...
1589         {'VMT is currently up to date, no updates available.';...
1590         '';...
1591         ['Latest available version: ' current_vmt_version];...
1592         ['Installed version: ' guiparams.vmt_version]},'Check for updates','modal'); %#ok<NASGU>
1593 else
1594     h = msgbox(...
1595         {'VMT is out of date. Please visit the VMT homepage.';...
1596         '';...
1597         ['Latest available version: ' current_vmt_version];...
1598         ['Installed version: ' guiparams.vmt_version]},'Check for updates','modal'); %#ok<NASGU>
1599 end
1600 % [EOF] menuCheckForUpdates_Callback
1601 
1602 % --------------------------------------------------------------------
1603 function menuAbout_Callback(hObject, eventdata, handles)
1604 
1605 % Get the Application data:
1606 % -------------------------
1607 guiparams = getappdata(handles.figure1,'guiparams');
1608 messagestr = ...
1609     {'The Velocity Mapping Toolbox';...
1610     ['   Version: ' guiparams.vmt_version];...
1611     '';...
1612     '';...
1613     'With collaborations from:';...
1614     '   U.S. Geological Survey';...
1615     '   University of Illinois';...
1616     '   University of Hull';...
1617     '';...
1618     '';...
1619     'Citation: ';...
1620     '   Parsons, D. R., Jackson, P. R., Czuba, J. A., Engel, F. L.,';...
1621     '   Rhoads, B. L., Oberg, K. A., Best, J. L., Mueller, D. S.,';...
1622     '   Johnson, K. K. and Riley, J. D. (2013), Velocity Mapping';...
1623     '   Toolbox (VMT): a processing and visualization suite for';...
1624     '   moving-vessel ADCP measurements. Earth Surf. Process.';...
1625     '   Landforms.doi: 10.1002/esp.3367'};
1626 h = msgbox(messagestr,'About VMT'); %#ok<NASGU>
1627 % [EOF] menuAbout_Callback
1628 
1629 
1630 
1631 
1632 %%%%%%%%%%%%%%%%%%%%%
1633 % TOOLBAR CALLBACKS %
1634 %%%%%%%%%%%%%%%%%%%%%
1635 
1636 % --------------------------------------------------------------------
1637 function loadDataCallback(hObject, eventdata, handles)
1638 % Read Files into Data Structure using tfile.
1639 
1640 % Get the Application data:
1641 % -------------------------
1642 guiparams = getappdata(handles.figure1,'guiparams');
1643 guiprefs = getappdata(handles.figure1,'guiprefs');
1644 
1645 % Ask the user to select files:
1646 % -----------------------------
1647 current_file = fullfile(guiprefs.ascii_path,guiprefs.ascii_file{1});
1648 [filename,pathname] = uigetfile({'*_ASC.TXT','ASCII (*_ASC.TXT)'}, ...
1649     'Select the ASCII Output Files', ...
1650     current_file, ...
1651     'MultiSelect','on');
1652 
1653 if ischar(pathname) % The user did not hit "Cancel"
1654     guiparams.data_folder = pathname;
1655     if ischar(filename)
1656         filename = {filename};
1657     end
1658     guiparams.data_files = filename;
1659     guiparams.mat_file = '';
1660     
1661     setappdata(handles.figure1,'guiparams',guiparams)
1662     
1663    
1664     
1665     % Update the preferences:
1666     % -----------------------
1667     guiprefs = getappdata(handles.figure1,'guiprefs');
1668     guiprefs.ascii_path = pathname;
1669     guiprefs.ascii_file = filename;
1670     setappdata(handles.figure1,'guiprefs',guiprefs)
1671     store_prefs(handles.figure1,'ascii')
1672     
1673     % Push messages to Log Window:
1674     % ----------------------------
1675     log_text = {...
1676         '';...
1677         ['%--- ' datestr(now) ' ---%'];...
1678         'Current Project Directory:';...
1679         guiparams.data_folder;
1680         'Loading the following files into memory:';...
1681         char(filename)};
1682     statusLogging(handles.LogWindow, log_text)
1683     
1684     % Read the file(s)
1685     % ----------------
1686     [~,~,savefile,A,z] = ...
1687         VMT_ReadFiles(guiparams.data_folder,guiparams.data_files);
1688     guiparams.savefile = savefile;
1689     guiparams.A        = A;
1690     guiparams.z        = z;
1691     
1692     
1693     % Set the vertical grid node spacing
1694     % ----------------------------------
1695     % For RioGrande probes, use the bin size, else just use the default
1696     % Backwards compatible
1697     if A(1).Sup.wm ~= 3 % RG
1698         set(handles.VerticalGridNodeSpacing,'String',double(A(1).Sup.binSize_cm(1))/100)
1699         guiparams.vertical_grid_node_spacing = double(A(1).Sup.binSize_cm(1))/100;
1700     else % Older file, must be RR or M9
1701         set(handles.VerticalGridNodeSpacing,'String',0.4)
1702         guiparams.vertical_grid_node_spacing = 0.4;
1703     end
1704     
1705     
1706     % Save application data
1707     % ---------------------
1708     setappdata(handles.figure1,'guiparams',guiparams)
1709        
1710 %
1711 %     % Preprocess the data:
1712 %     % --------------------
1713 %     A = VMT_PreProcess(z,A);
1714 %
1715 %     % Push messages to Log Window:
1716 %     % ----------------------------
1717 %     log_text = {...
1718 %         '   Preprocessing complete.';...
1719 %         '   Begin Data Processing...'};
1720 %     statusLogging(handles.LogWindow, log_text)
1721 %
1722 %     A(1).hgns = guiparams.horizontal_grid_node_spacing;
1723 %     A(1).wse  = guiparams.wse;  %Set the WSE to entered value
1724 %     [A,V,processing_log_text] = VMT_ProcessTransects(z,A,...
1725 %         guiparams.set_cross_section_endpoints,...
1726 %         guiparams.unit_discharge_correction);
1727 %
1728 %     % Push messages to Log Window:
1729 %     % ----------------------------
1730 %     statusLogging(handles.LogWindow, processing_log_text)
1731 %
1732 %     % Store the data:
1733 %     % ---------------
1734 %     guiparams.z = z;
1735 %     guiparams.A = A;
1736 %     guiparams.V = V;
1737 %     setappdata(handles.figure1,'guiparams',guiparams)
1738     
1739           
1740     % Update the GUI:
1741     % ---------------
1742     set_enable(handles,'fileloaded')
1743     
1744     % If data are RG or SP, set vertical grid node spacing to bin size
1745     
1746 end
1747 % [EOF] loadDataCallback
1748 
1749 
1750 
1751 % --------------------------------------------------------------------
1752 function saveDataCallback(hObject, eventdata, handles)
1753 % SaveMATFile_Callback(handles.SaveMATFile,eventdata,handles)
1754 
1755 % Get the Application data:
1756 % -------------------------
1757 guiparams = getappdata(handles.figure1,'guiparams');
1758 z   = guiparams.z;   %#ok<NASGU>
1759 A   = guiparams.A;   %#ok<NASGU>
1760 V   = guiparams.V;   %#ok<NASGU>
1761 Map = guiparams.Map; %#ok<NASGU>
1762 
1763 [the_file,the_path] = ...
1764     uiputfile({'*.mat','MAT-Files (*.mat)'}, ...
1765     'Save MAT-File', ...
1766     fullfile(guiparams.mat_path,guiparams.savefile));
1767 
1768 % Save the processed data to a MAT file:
1769 % --------------------------------------
1770 if ischar(the_file)
1771     guiparams.mat_path = the_path;
1772     guiparams.mat_file = the_file;
1773     guiparams.savefile = the_file;
1774     
1775     % Re-store the Application data:
1776     % ------------------------------
1777     setappdata(handles.figure1,'guiparams',guiparams)
1778     
1779     % Update the preferences:
1780     % -----------------------
1781     guiprefs = getappdata(handles.figure1,'guiprefs');
1782     guiprefs.mat_path = the_path;
1783     guiprefs.mat_file = the_file;
1784     setappdata(handles.figure1,'guiprefs',guiprefs)
1785     store_prefs(handles.figure1,'mat')
1786     
1787     [pathstr,filename,extension] = fileparts([guiparams.mat_path guiparams.savefile]);
1788     savefile = fullfile(pathstr,[filename extension]);
1789     %h = msgbox(['Saving processed data in MAT File ''' filename extension ''''], ...
1790     %    'Saving Processed Data File...'); %#ok<NASGU>
1791     log_text = {...
1792         'Saving Processed Data File...';...
1793         savefile};
1794     statusLogging(handles.LogWindow,log_text)
1795     save(savefile,'A','V','z','Map')
1796 end
1797 
1798 % [EOF] saveDataCallback
1799 
1800 
1801 % --------------------------------------------------------------------
1802 function saveBathymetryCallback(hObject, eventdata, handles)
1803 
1804 % Get the Application data:
1805 % -------------------------
1806 guiparams = getappdata(handles.figure1,'guiparams');
1807 z   = guiparams.z;
1808 A   = guiparams.A;
1809 % V   = guiparams.V;   %#ok<NASGU>
1810 % Map = guiparams.Map; %#ok<NASGU>
1811 
1812 % Compute multibeam bathymetry:
1813 % -----------------------------
1814 msgbox('Processing Bathymetry...Please Be Patient','VMT Status','help','replace')
1815 %A = VMT_MBBathy(z,A,savefile,handles.beam_angle,handles.MagneticVariation,handles.WSE);
1816 VMT_MBBathy(z,A,savefile, ...
1817     guiparams.beam_angle, ...
1818     guiparams.magnetic_variation, ...
1819     guiparams.wse, ...
1820     guiparams.output_auxiliary_data);
1821 
1822 msgbox('Bathymetry Output Complete','VMT Status','help','replace')
1823 
1824 % [EOF] saveBathymetryCallback
1825 
1826 % --------------------------------------------------------------------
1827 function plottingParametersCallback(hObject, eventdata, handles)
1828 
1829 % Get the Application data:
1830 % -------------------------
1831 guiparams = getappdata(handles.figure1,'guiparams');
1832 
1833 [guiparams.english_units,guiparams.set_cross_section_endpoints,...
1834     guiparams.presentation,guiparams.print] = ...
1835     plotParametersDialog(guiparams.english_units, ...
1836     guiparams.set_cross_section_endpoints,...
1837     guiparams.presentation,guiparams.print,...
1838     handles.figure1);
1839 
1840 % Update the GUI:
1841 % ---------------
1842 if guiparams.english_units
1843     set(handles.menuMetric, 'Checked','off')
1844     set(handles.menuEnglish,'Checked','on')
1845 else
1846     set(handles.menuMetric, 'Checked','on')
1847     set(handles.menuEnglish,'Checked','off')
1848 end
1849 
1850 if guiparams.set_cross_section_endpoints
1851     set(handles.menuCrossSectionEndpointAutomatic,'Checked','off')
1852     set(handles.menuCrossSectionEndpointManual,   'Checked','on')
1853 else
1854     set(handles.menuCrossSectionEndpointAutomatic,'Checked','on')
1855     set(handles.menuCrossSectionEndpointManual,   'Checked','off')
1856 end
1857 
1858 if guiparams.presentation
1859     menuStylePresentation_Callback(hObject, eventdata, handles)
1860 %     set(handles.menuStylePrint,           'Checked','off')
1861 %     set(handles.menuStylePresentation,    'Checked','on')
1862 %     set(handles.menuPrintFormat,          'Checked','off')
1863 %     set(handles.menuPresentationFormat,   'Checked','on')
1864 else
1865     menuStylePrint_Callback(hObject, eventdata, handles)
1866 %     set(handles.menuStylePrint,           'Checked','on')
1867 %     set(handles.menuStylePresentation,    'Checked','off')
1868 %     set(handles.menuPrintFormat,          'Checked','on')
1869 %     set(handles.menuPresentationFormat,   'Checked','off')
1870 end
1871 
1872 % Re-store the Application data:
1873 % ------------------------------
1874 setappdata(handles.figure1,'guiparams',guiparams)
1875 
1876 % [EOF] plottingParametersCallback
1877 
1878 
1879 % --------------------------------------------------------------------
1880 function processingParametersCallback(hObject, eventdata, handles)
1881 
1882 % Get the Application data:
1883 % -------------------------
1884 guiparams = getappdata(handles.figure1,'guiparams');
1885 z   = guiparams.z;   %#ok<NASGU>
1886 A   = guiparams.A;   %#ok<NASGU>
1887 V   = guiparams.V;   %#ok<NASGU>
1888 Map = guiparams.Map; %#ok<NASGU>
1889 
1890 % [EOF] processingParametersCallback
1891 
1892 
1893 % --------------------------------------------------------------------
1894 function shiptracksPlotCallback(hObject, eventdata, handles)
1895 % Plot 1
1896 
1897 % Get the Application data:
1898 % -------------------------
1899 guiparams = getappdata(handles.figure1,'guiparams');
1900 z = guiparams.z;
1901 A = guiparams.A;
1902 V = guiparams.V; %#ok<NASGU>
1903 % Map = guiparams.Map;
1904 setends = guiparams.set_cross_section_endpoints;
1905 
1906 % Preprocess the data:
1907 % --------------------
1908 A = VMT_PreProcess(z,A);
1909 
1910 % Push messages to Log Window:
1911 % ----------------------------
1912 log_text = {...
1913     '   Preprocessing complete.';...
1914     '   Begin Data Processing...'};
1915 statusLogging(handles.LogWindow, log_text)
1916 
1917 % Process the transects:
1918 % ----------------------
1919 A(1).hgns = guiparams.horizontal_grid_node_spacing;
1920 A(1).vgns = guiparams.vertical_grid_node_spacing;
1921 A(1).wse  = guiparams.wse;  %Set the WSE to entered value
1922 [A,V,processing_log_text] = VMT_ProcessTransects(z,A,...
1923     guiparams.set_cross_section_endpoints,guiparams.unit_discharge_correction);
1924 
1925 % Compute the smoothed variables
1926 % ------------------------------
1927 % This is required so that the V struc is complete at any point during
1928 % runtime.
1929 V = VMT_SmoothVar(V, ...
1930     ...guiparams.contour, ...
1931     guiparams.horizontal_smoothing_window, ...
1932     guiparams.vertical_smoothing_window);
1933 
1934 % Push messages to Log Window:
1935 % ----------------------------
1936 statusLogging(handles.LogWindow, processing_log_text)
1937 
1938 % Store the data:
1939 % ---------------
1940 guiparams.z = z;
1941 guiparams.A = A;
1942 guiparams.V = V;
1943 setappdata(handles.figure1,'guiparams',guiparams)
1944 
1945 % Push messages to Log Window:
1946 % ----------------------------
1947 log_text = {'Plotting Shiptracks (reprocessing)'};
1948 statusLogging(handles.LogWindow, log_text)
1949 
1950 % Create or replot the Shiptracks
1951 % -------------------------------
1952 % Grab the axes to the plot
1953 % axes(handles.Plot1Shiptracks);
1954 VMT_PlotShiptracks(A,V,z,setends,handles.Plot1Shiptracks); % PLOT 1
1955 
1956 %%%%%%%%%%%%%%%%%%%%%%%%%
1957 % New plot display window
1958 % h = VMT_CreatePlotDisplay('shiptracks');
1959 % h = figure(1); clf
1960 %%%%%%%%%%%%%%%%%%%%%%%%%
1961 
1962 % [EOF] shiptracksPlotCallback
1963 
1964 
1965 % --------------------------------------------------------------------
1966 function planviewPlotCallback(hObject, eventdata, handles)
1967 % Plot 2
1968 
1969 % Get the Application data:
1970 % -------------------------
1971 guiparams = getappdata(handles.figure1,'guiparams');
1972 guiprefs  = getappdata(handles.figure1,'guiprefs');
1973 
1974 if iscell(guiparams.mat_file) % Multiple MAT files loaded
1975     % Push messages to Log Window:
1976     % ----------------------------
1977     log_text = {'Plotting Multiple Transects (Planview)'};
1978     statusLogging(handles.LogWindow, log_text)
1979     
1980        
1981     % Push plotting parameters to log window:
1982     % ---------------------------------------
1983     log_text = {...
1984         'Plan View Plotting Parameters';...
1985         sprintf('   Depth range %3.1f to %3.1f m',guiparams.depth_range_min, guiparams.depth_range_max);...
1986         sprintf('   Vector scale: %d',guiparams.vector_scale_plan_view);...
1987         sprintf('   Vector spacing: %d',guiparams.vector_spacing_plan_view);...
1988         sprintf('   Smoothing window size: %d',guiparams.smoothing_window_size);...
1989         };
1990     statusLogging(handles.LogWindow, log_text)
1991     
1992     % Plot the data:
1993     % --------------
1994     z = [];
1995     A = [];
1996     V = [];
1997     Map = [];
1998     depth_range = [guiparams.depth_range_min guiparams.depth_range_max];
1999     [PVdata,~,log_text] = VMT_PlotPlanViewQuivers(z,A,V,Map, ...
2000         depth_range, ...
2001         guiparams.vector_scale_plan_view, ...
2002         guiparams.vector_spacing_plan_view, ...
2003         guiparams.smoothing_window_size, ...
2004         guiparams.display_shoreline, ...
2005         guiparams.english_units, ...
2006         guiparams.mat_file, ...
2007         guiparams.mat_path); % PLOT2
2008     statusLogging(handles.LogWindow, log_text)
2009     
2010     % Plot a Shoreline Map:
2011     % ---------------------
2012     if guiparams.display_shoreline
2013         [guiprefs.shoreline_file,guiprefs.shoreline_path] = uigetfile(...
2014             {'*.txt;*.csv','All Text Files'; '*.*','All Files'},...
2015             'Select Map Text File',...
2016             fullfile(guiprefs.shoreline_path,guiprefs.shoreline_file));
2017         if ischar(guiprefs.shoreline_file) % User did not hit cancel
2018             mapdata = dlmread(fullfile(guiprefs.shoreline_path,guiprefs.shoreline_file));
2019             Map.UTMe   = mapdata(:,1);
2020             Map.UTMn   = mapdata(:,2);
2021             Map.infile = fullfile(guiprefs.shoreline_path,guiprefs.shoreline_file);
2022             %Map.UTMzone = zone;
2023         else
2024             Map = [];
2025         end
2026         VMT_PlotShoreline(Map)
2027         log_text = {...
2028             '   Loading map file.';...
2029             '   Plotting shoreline.'...
2030             };
2031         statusLogging(handles.LogWindow, log_text)
2032     else
2033         Map = [];
2034     end
2035     
2036 else
2037     z = guiparams.z;
2038     A = guiparams.A;
2039     % V = guiparams.V;
2040     Map = guiparams.Map;
2041     
2042     % Push messages to Log Window:
2043     % ----------------------------
2044     log_text = {'Plotting Depth Averaged Vectors (reprocessing)'};
2045     statusLogging(handles.LogWindow, log_text)
2046     
2047         
2048     % Preprocess the data:
2049     % --------------------
2050     A = VMT_PreProcess(z,A);
2051     
2052     % Process the transects:
2053     % ----------------------
2054     A(1).hgns = guiparams.horizontal_grid_node_spacing;
2055     A(1).vgns = guiparams.vertical_grid_node_spacing;
2056     A(1).wse  = guiparams.wse;  %Set the WSE to entered value
2057     [A,V,processing_log_text] = VMT_ProcessTransects(z,A,...
2058         guiparams.set_cross_section_endpoints,guiparams.unit_discharge_correction);
2059     
2060     % Compute the smoothed variables
2061     % ------------------------------
2062     % This is required so that the V struc is complete at any point during
2063     % runtime.
2064     V = VMT_SmoothVar(V, ...
2065         ...guiparams.contour, ...
2066         guiparams.horizontal_smoothing_window, ...
2067         guiparams.vertical_smoothing_window);
2068     
2069     % Push messages to Log Window:
2070     % ----------------------------
2071     statusLogging(handles.LogWindow, processing_log_text)
2072     
2073     % Plot the cross section:
2074     % -----------------------
2075     log_text = {...
2076         'Plan View Plotting Parameters';...
2077         sprintf('   Depth range %3.1f to %3.1f m',guiparams.depth_range_min, guiparams.depth_range_max);...
2078         sprintf('   Vector scale: %d',guiparams.vector_scale_plan_view);...
2079         sprintf('   Vector spacing: %d',guiparams.vector_spacing_plan_view);...
2080         sprintf('   Smoothing window size: %d',guiparams.smoothing_window_size);...
2081         };
2082     statusLogging(handles.LogWindow, log_text)
2083     
2084     % Plot the data:
2085     % --------------
2086     %msgbox('Plotting Plan View','VMT Status','help','replace');
2087     depth_range = [guiparams.depth_range_min guiparams.depth_range_max];
2088     
2089     
2090     [PVdata,~,log_text] = VMT_PlotPlanViewQuivers(z,A,V,Map, ...
2091         depth_range, ...
2092         guiparams.vector_scale_plan_view, ...
2093         guiparams.vector_spacing_plan_view, ...
2094         guiparams.smoothing_window_size, ...
2095         guiparams.display_shoreline, ...
2096         guiparams.english_units, ...
2097         guiparams.mat_file, ...
2098         guiparams.mat_path); % PLOT2
2099     statusLogging(handles.LogWindow, log_text)
2100     
2101     % Plot a Shoreline Map:
2102     % ---------------------
2103     if guiparams.display_shoreline
2104         [guiprefs.shoreline_file,guiprefs.shoreline_path] = uigetfile(...
2105             {'*.txt;*.csv','All Text Files'; '*.*','All Files'},...
2106             'Select Map Text File',...
2107             fullfile(guiprefs.shoreline_path,guiprefs.shoreline_file));
2108         if ischar(guiprefs.shoreline_file) % User did not hit cancel
2109             mapdata = dlmread(fullfile(guiprefs.shoreline_path,guiprefs.shoreline_file));
2110             Map.UTMe   = mapdata(:,1);
2111             Map.UTMn   = mapdata(:,2);
2112             Map.infile = fullfile(guiprefs.shoreline_path,guiprefs.shoreline_file);
2113             %Map.UTMzone = zone;
2114         else
2115             Map = [];
2116         end
2117         VMT_PlotShoreline(Map)
2118         log_text = {...
2119             '   Loading map file.';...
2120             '   Plotting shoreline.'...
2121             };
2122         statusLogging(handles.LogWindow, log_text)
2123     else
2124         Map = [];
2125     end
2126     
2127 end
2128 
2129 if guiparams.add_background
2130     [guiprefs,log_text] = VMT_OverlayDOQQ(guiprefs);
2131     statusLogging(handles.LogWindow, log_text)
2132 end
2133 
2134 % Update guiparams
2135 % ----------------
2136 guiparams.z   = z;
2137 guiparams.A   = A;
2138 guiparams.V   = V;
2139 guiparams.Map = Map;
2140 guiparams.iric_anv_planview_data = PVdata;
2141 setappdata(handles.figure1,'guiparams',guiparams);
2142 
2143 % Update preferences
2144 % ------------------
2145 setappdata(handles.figure1,'guiprefs',guiprefs)
2146 store_prefs(handles.figure1,'shoreline')
2147 store_prefs(handles.figure1,'aerial')
2148 
2149 % Force plot to be formated properly
2150 % ----------------------------------
2151 if guiparams.presentation
2152     menuStylePresentation_Callback(hObject, eventdata, handles)
2153 else
2154     menuStylePrint_Callback(hObject, eventdata, handles)
2155 end
2156 switch guiparams.renderer
2157     case 'OpenGL'
2158         menuOpenGL_Callback(hObject, eventdata, handles)
2159     case 'painters'
2160         menuPainters_Callback(hObject, eventdata, handles)
2161     case 'zbuffer'
2162         menuZbuffer_Callback(hObject, eventdata, handles)
2163 end
2164 
2165 % Focus the figure
2166 % ----------------
2167 hff = findobj('name','Plan View Map');
2168 if ~isempty(hff) &&  ishandle(hff)
2169     figure(hff)
2170 end
2171 
2172 % Start the Graphics Control Gui
2173 % ------------------------------
2174 VMT_GraphicsControl
2175 
2176 % [EOF] planviewPlotCallback
2177 
2178 
2179 % --------------------------------------------------------------------
2180 function crosssectionPlotCallback(hObject, eventdata, handles)
2181 % Plot 3
2182 
2183 % Get the Application data:
2184 % -------------------------
2185 guiparams = getappdata(handles.figure1,'guiparams');
2186 z = guiparams.z;
2187 A = guiparams.A;
2188 % V = guiparams.V;
2189 % Map = guiparams.Map;
2190 
2191 % Preprocess the data:
2192 % --------------------
2193 A = VMT_PreProcess(z,A);
2194 
2195 % Push messages to Log Window:
2196 % ----------------------------
2197 log_text = {'Plotting Cross Section (reprocessing)'};
2198 statusLogging(handles.LogWindow, log_text)
2199 
2200 % Process the transects:
2201 % ----------------------
2202 A(1).hgns = guiparams.horizontal_grid_node_spacing;
2203 A(1).vgns = guiparams.vertical_grid_node_spacing;
2204 A(1).wse  = guiparams.wse;  %Set the WSE to entered value
2205 [A,V,processing_log_text] = VMT_ProcessTransects(z,A,...
2206     guiparams.set_cross_section_endpoints,guiparams.unit_discharge_correction);
2207 
2208 % Push messages to Log Window:
2209 % ----------------------------
2210 statusLogging(handles.LogWindow, processing_log_text)
2211 
2212 % Plot the cross section:
2213 % -----------------------
2214 log_text = {...
2215     'Cross Section Plotting Parameters';...
2216     sprintf('   Contour variable: %s'          ,guiparams.contours(guiparams.idx_contour).string);...
2217     sprintf('   Vertical exaggeration: %d'     ,guiparams.vertical_exaggeration);...
2218     sprintf('   Vector scale: %3.1f'           ,guiparams.vector_scale_cross_section);...
2219     sprintf('   Horizontal vector spacing: %d' ,guiparams.horizontal_vector_spacing);...
2220     sprintf('   Vertical vector spacing: %d'   ,guiparams.vertical_vector_spacing);...
2221     sprintf('   Horizontal smooting window: %d',guiparams.horizontal_smoothing_window);...
2222     sprintf('   Vertical smoothing window: %d' ,guiparams.vertical_smoothing_window);...
2223     };
2224 if guiparams.plot_secondary_flow_vectors
2225     log_text = vertcat(log_text, {...
2226         sprintf('   Vector variable: %s',guiparams.secondary_flows(guiparams.idx_secondary_flow_vector_variable).string);...
2227         sprintf('   Inc. vertical component?: %d',guiparams.include_vertical_velocity)...
2228         });
2229 end
2230 % Push messages to Log Window:
2231 % ----------------------------
2232 statusLogging(handles.LogWindow, log_text)
2233 
2234 if guiparams.plot_secondary_flow_vectors
2235     %msgbox('Plotting Cross Section','VMT Status','help','replace')
2236 %     V = VMT_SmoothVar(V, ...
2237 %         ...guiparams.contour, ...
2238 %         guiparams.horizontal_smoothing_window, ...
2239 %         guiparams.vertical_smoothing_window);
2240     V = VMT_SmoothVar(V, ...
2241         ...guiparams.secondary_flow_vector_variable, ...
2242         guiparams.horizontal_smoothing_window, ...
2243         guiparams.vertical_smoothing_window);
2244     [~,A,V,plot_cont_log_text] = VMT_PlotXSContQuiver(z,A,V, ...
2245         guiparams.contour, ...
2246         guiparams.vector_scale_cross_section, ...
2247         guiparams.vertical_exaggeration, ...
2248         guiparams.horizontal_vector_spacing, ...
2249         guiparams.vertical_vector_spacing, ...
2250         guiparams.secondary_flow_vector_variable, ...
2251         guiparams.include_vertical_velocity, ...
2252         guiparams.english_units); %#ok<ASGLU> % PLOT3
2253     
2254 elseif ~guiparams.plot_secondary_flow_vectors
2255     V = VMT_SmoothVar(V, ...
2256         ...guiparams.contour, ...
2257         guiparams.horizontal_smoothing_window, ...
2258         guiparams.vertical_smoothing_window);
2259     
2260     [~,A,V,zmin,zmax,plot_cont_log_text] = VMT_PlotXSCont(z,A,V, ...
2261         guiparams.contour, ...
2262         guiparams.vertical_exaggeration, ...
2263         guiparams.english_units);  %#ok<ASGLU>
2264     
2265     guiparams.zmin = zmin;
2266     guiparams.zmax = zmax;
2267     setappdata(handles.figure1,'guiparams',guiparams)
2268 end
2269 
2270 % Force plot to be formated properly
2271 % ----------------------------------
2272 if guiparams.presentation
2273     menuStylePresentation_Callback(hObject, eventdata, handles)
2274 else
2275     menuStylePrint_Callback(hObject, eventdata, handles)
2276 end
2277 switch guiparams.renderer
2278     case 'OpenGL'
2279         menuOpenGL_Callback(hObject, eventdata, handles)
2280     case 'painters'
2281         menuPainters_Callback(hObject, eventdata, handles)
2282     case 'zbuffer'
2283         menuZbuffer_Callback(hObject, eventdata, handles)
2284 end
2285 
2286 % Focus the figure
2287 % ----------------
2288 hff = findobj('name','Mean Cross Section Contour');
2289 if ~isempty(hff) &&  ishandle(hff)
2290     figure(hff)
2291 end
2292 
2293 % Re-store the Application data:
2294 % ------------------------------
2295 guiparams.V = V;
2296 setappdata(handles.figure1,'guiparams',guiparams)
2297 
2298 % Start the Graphics Control Gui
2299 % ------------------------------
2300 VMT_GraphicsControl
2301 
2302 % Push messages to Log Window:
2303 % ----------------------------
2304 statusLogging(handles.LogWindow, plot_cont_log_text)
2305 % msgbox('Plotting Complete','VMT Status','help','replace')
2306 
2307 % [EOF] crosssectionPlotCallback
2308 
2309 
2310 %%%%%%%%%%%%%%%%%%%%%%%%%
2311 % DATA EXPORT CALLBACKS %
2312 %%%%%%%%%%%%%%%%%%%%%%%%%
2313 
2314 % --------------------------------------------------------------------
2315 function SaveMATFile_Callback(hObject, eventdata, handles)
2316 % saveDataCallback(hObject, eventdata, handles)
2317 
2318 % Get the Application data:
2319 % -------------------------
2320 guiparams = getappdata(handles.figure1,'guiparams');
2321 z   = guiparams.z;   %#ok<NASGU>
2322 A   = guiparams.A;   %#ok<NASGU>
2323 V   = guiparams.V;   %#ok<NASGU>
2324 Map = guiparams.Map; %#ok<NASGU>
2325 
2326 [the_file,the_path] = ...
2327     uiputfile({'*.mat','MAT-Files (*.mat)'}, ...
2328     'Save MAT-File', ...
2329     fullfile(guiparams.mat_path,guiparams.savefile));
2330 
2331 % Save the processed data to a MAT file:
2332 % --------------------------------------
2333 if ischar(the_file)
2334     guiparams.mat_path = the_path;
2335     guiparams.mat_file = the_file;
2336     guiparams.savefile = the_file;
2337     
2338     % Re-store the Application data:
2339     % ------------------------------
2340     setappdata(handles.figure1,'guiparams',guiparams)
2341     
2342     % Update the preferences:
2343     % -----------------------
2344     guiprefs = getappdata(handles.figure1,'guiprefs');
2345     guiprefs.mat_path = the_path;
2346     guiprefs.mat_file = the_file;
2347     setappdata(handles.figure1,'guiprefs',guiprefs)
2348     store_prefs(handles.figure1,'mat')
2349     
2350     [~,filename,extension] = fileparts(guiparams.savefile);
2351     savefile = [filename extension];
2352     h = msgbox(['Saving processed data in MAT File ''' savefile ''''], ...
2353         'Saving Processed Data File...'); %#ok<NASGU>
2354     disp('Saving Processed Data File...')
2355     disp(savefile)
2356     save(savefile,'A','V','z','Map')
2357 end
2358 
2359 % [EOF] SaveMATFile_Callback
2360 
2361 
2362 % --------------------------------------------------------------------
2363 function SaveTecplotFile_Callback(hObject, eventdata, handles)
2364 
2365 % Get the Application data:
2366 % -------------------------
2367 guiparams = getappdata(handles.figure1,'guiparams');
2368 % z   = guiparams.z;
2369 % A   = guiparams.A;
2370 V   = guiparams.V;
2371 % Map = guiparams.Map;
2372 
2373 [the_file,the_path] = ...
2374     uiputfile({'*.dat','Tecplot Files (*.dat)'}, ...
2375     'Save Tecplot File', ...
2376     fullfile(guiparams.tecplot_path,guiparams.tecplot_file));
2377 
2378 % Output the data (no smoothing) to Tecplot:
2379 % ------------------------------------------
2380 if ischar(the_file)
2381     guiparams.tecplot_path = the_path;
2382     guiparams.tecplot_file = the_file;
2383     
2384     % Re-store the Application data:
2385     % ------------------------------
2386     setappdata(handles.figure1,'guiparams',guiparams)
2387     
2388     % Update the preferences:
2389     % -----------------------
2390     guiprefs = getappdata(handles.figure1,'guiprefs');
2391     guiprefs.tecplot_path = the_path;
2392     guiprefs.tecplot_file = the_file;
2393     setappdata(handles.figure1,'guiprefs',guiprefs)
2394     store_prefs(handles.figure1,'tecplot')
2395     
2396     % Push to log window
2397     % ------------------
2398     log_text = {...
2399         'Exporting Data to Tecplot (*.dat) File...';...
2400         'Directory:';...
2401         the_path;...
2402         ['Filename: ' the_file]};
2403     statusLogging(handles.LogWindow,log_text)
2404         
2405     if isempty(V)
2406         A = guiparams.A;
2407         A(1).hgns = guiparams.horizontal_grid_node_spacing;
2408         A(1).vgns = guiparams.vertical_grid_node_spacing;
2409         A(1).wse  = guiparams.wse;  %Set the WSE to entered value
2410         [~,V,processing_log_text] = VMT_ProcessTransects(z,A,...
2411             guiparams.set_cross_section_endpoints,...
2412             guiparams.unit_discharge_correction);
2413     end
2414     VMT_BuildTecplotFile(V,fullfile(guiparams.tecplot_path,guiparams.tecplot_file));
2415     
2416     % Push to log window
2417     % ------------------
2418     log_text = {'Exporting XS Bathy Data to Tecplot (*.dat) File...'};
2419     statusLogging(handles.LogWindow,log_text)
2420     
2421     VMT_BuildTecplotFile_XSBathy(V,fullfile(guiparams.tecplot_path,guiparams.tecplot_file));
2422     
2423     % Push to log window
2424     % ------------------
2425     log_text = {'Tecplot Export Complete'};
2426     statusLogging(handles.LogWindow,log_text)
2427    
2428 end
2429 
2430 % [EOF] SaveTechplotFile_Callback
2431 
2432 
2433 % --------------------------------------------------------------------
2434 function SaveGoogleEarthFile_Callback(hObject, eventdata, handles)
2435 
2436 % Get the Application data:
2437 % -------------------------
2438 guiparams = getappdata(handles.figure1,'guiparams');
2439 % z   = guiparams.z;
2440 A   = guiparams.A;
2441 V   = guiparams.V;
2442 Map = guiparams.Map; %#ok<NASGU>
2443 
2444 [the_file,the_path] = ...
2445     uiputfile({'*.kmz','Google Earth Files (*.kmz)'}, ...
2446     'Save Google Earth File', ...
2447     fullfile(guiparams.kmz_path,guiparams.kmz_file));
2448 
2449 % Save the processed data to a Google Earth (KMZ) file:
2450 % -----------------------------------------------------
2451 if ischar(the_file)
2452     guiparams.kmz_path = the_path;
2453     guiparams.kmz_file = the_file;
2454     
2455     % Re-store the Application data:
2456     % ------------------------------
2457     setappdata(handles.figure1,'guiparams',guiparams)
2458     
2459     % Update the preferences:
2460     % -----------------------
2461     guiprefs = getappdata(handles.figure1,'guiprefs');
2462     guiprefs.kmz_path = the_path;
2463     guiprefs.kmz_file = the_file;
2464     setappdata(handles.figure1,'guiprefs',guiprefs)
2465     store_prefs(handles.figure1,'kmz')
2466     
2467     %     if guiparams.display_shoreline
2468     %         VMT_Shoreline2GE_3D(A,Map, ...
2469     %                             guiparams.vertical_exaggeration, ...
2470     %                             guiparams.vertical_offset);
2471     %     end
2472     if isempty(V)
2473         A = guiparams.A;
2474         A(1).hgns = guiparams.horizontal_grid_node_spacing;
2475         A(1).vgns = guiparams.vertical_grid_node_spacing;
2476         A(1).wse  = guiparams.wse;  %Set the WSE to entered value
2477         [~,V,processing_log_text] = VMT_ProcessTransects(z,A,...
2478             guiparams.set_cross_section_endpoints,...
2479             guiparams.unit_discharge_correction);
2480     end
2481     VMT_MeanXS2GE_3D(A,V,[], ...
2482         fullfile(guiparams.kmz_path,guiparams.kmz_file), ...
2483         guiparams.vertical_exaggeration, ...
2484         guiparams.vertical_offset);
2485 end
2486 
2487 % [EOF] SaveGoogleEarthFile_Callback
2488 
2489 
2490 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2491 % DATA EXPORT/BATHYMETRY CALLBACKS %
2492 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2493 
2494 % --------------------------------------------------------------------
2495 function ExportMultibeamBathymetry_Callback(hObject, eventdata, handles)
2496 
2497 % Get the Application data:
2498 % -------------------------
2499 guiparams = getappdata(handles.figure1,'guiparams');
2500 guiprefs  = getappdata(handles.figure1,'guiprefs');
2501 z = guiparams.z;
2502 A = guiparams.A;
2503 V = guiparams.V; %#ok<NASGU>
2504 % Map = guiparams.Map;
2505 setends = guiparams.set_cross_section_endpoints;
2506 
2507 [the_file,the_path] = ...
2508     uiputfile({'*.csv','Multibeam Bathymetry Files (*.csv)'}, ...
2509     'Export Multibeam Bathymetry', ...
2510     fullfile(guiprefs.multibeambathymetry_path, ...
2511     guiprefs.multibeambathymetry_file));
2512 
2513 if ischar(the_file)
2514     guiparams.multibeambathymetry_path = the_path;
2515     guiparams.multibeambathymetry_file = the_file;
2516     
2517     % Re-store the Application data:
2518     % ------------------------------
2519     setappdata(handles.figure1,'guiparams',guiparams)
2520     
2521     % Update the preferences:
2522     % -----------------------
2523     guiprefs = getappdata(handles.figure1,'guiprefs');
2524     guiprefs.multibeambathymetry_path = the_path;
2525     guiprefs.multibeambathymetry_file = the_file;
2526     setappdata(handles.figure1,'guiprefs',guiprefs)
2527     store_prefs(handles.figure1,'multibeambathymetry')
2528     
2529     if guiparams.output_auxiliary_data
2530     end
2531     
2532     %msgbox('Processing Bathymetry...Please Be Patient','VMT Status','help','replace')
2533     
2534     savefile = fullfile(guiparams.multibeambathymetry_path, ...
2535         guiparams.multibeambathymetry_file);
2536     
2537     log_text = {'Multibeam bathymetry file saved to:';...
2538         ['   ' savefile]};
2539     statusLogging(handles.LogWindow,log_text)
2540     
2541     % Process the transects:
2542     % ----------------------
2543     A(1).hgns = guiparams.horizontal_grid_node_spacing;
2544     A(1).vgns = guiparams.vertical_grid_node_spacing;
2545     A(1).wse  = guiparams.wse;  %Set the WSE to entered value
2546     [A,V,processing_log_text] = VMT_ProcessTransects(z,A,...
2547         guiparams.set_cross_section_endpoints,guiparams.unit_discharge_correction);
2548     
2549     % Compute the smoothed variables
2550     % ------------------------------
2551     % This is required so that the V struc is complete at any point during
2552     % runtime.
2553     V = VMT_SmoothVar(V, ...
2554         ...guiparams.contour, ...
2555         guiparams.horizontal_smoothing_window, ...
2556         guiparams.vertical_smoothing_window);
2557     
2558     % Push messages to Log Window:
2559     % ----------------------------
2560     statusLogging(handles.LogWindow, processing_log_text)
2561 
2562     
2563     VMT_MBBathy(guiparams.z, ...
2564         guiparams.A, ...
2565         savefile, ...
2566         guiparams.beam_angle, ...
2567         guiparams.magnetic_variation, ...
2568         guiparams.wse, ...
2569         guiparams.output_auxiliary_data);
2570     
2571     %msgbox('Bathymetry Output Complete','VMT Status','help','replace')
2572     
2573 end
2574 
2575 % [EOF] ExportMultibeamBathymetry_Callback
2576 
2577 
2578 % --------------------------------------------------------------------
2579 function BeamAngle_Callback(hObject, eventdata, handles)
2580 % Get the beam angle
2581 
2582 % Get the Application data:
2583 % -------------------------
2584 guiparams = getappdata(handles.figure1,'guiparams');
2585 
2586 % Get the new entry and make sure it is valid (numeric, positive):
2587 % ----------------------------------------------------------------
2588 new_beam_angle = str2double(get(hObject,'String'));
2589 is_a_number = ~isnan(new_beam_angle);
2590 is_positive = new_beam_angle>=0;
2591 
2592 % Modify the Application data:
2593 % ----------------------------
2594 if is_a_number && is_positive
2595     guiparams.beam_angle = new_beam_angle;
2596     
2597     % Re-store the Application data:
2598     % ------------------------------
2599     setappdata(handles.figure1,'guiparams',guiparams)
2600     
2601 else % Reject the (incorrect) input
2602     set(hObject,'String',guiparams.beam_angle)
2603 end
2604 
2605 % [EOF] BeamAngle_Callback
2606 
2607 
2608 % --------------------------------------------------------------------
2609 function MagneticVariation_Callback(hObject, eventdata, handles)
2610 % Get the Magnetic Variation
2611 
2612 % Get the Application data:
2613 % -------------------------
2614 guiparams = getappdata(handles.figure1,'guiparams');
2615 
2616 % Get the new entry and make sure it is valid (numeric, positive):
2617 % ----------------------------------------------------------------
2618 new_magnetic_variation = str2double(get(hObject,'String'));
2619 is_a_number = ~isnan(new_magnetic_variation);
2620 is_positive = new_magnetic_variation>=0;
2621 
2622 % Modify the Application data:
2623 % ----------------------------
2624 if is_a_number && is_positive
2625     guiparams.magnetic_variation = new_magnetic_variation;
2626     
2627     % Re-store the Application data:
2628     % ------------------------------
2629     setappdata(handles.figure1,'guiparams',guiparams)
2630     
2631 else % Reject the (incorrect) input
2632     set(hObject,'String',guiparams.magnetic_variation)
2633 end
2634 
2635 % [EOF] MagneticVariation_Callback
2636 
2637 
2638 % --------------------------------------------------------------------
2639 function WSE_Callback(hObject, eventdata, handles)
2640 
2641 % Get the Application data:
2642 % -------------------------
2643 guiparams = getappdata(handles.figure1,'guiparams');
2644 
2645 % Get the new entry and make sure it is valid (numeric, positive):
2646 % ----------------------------------------------------------------
2647 new_wse = str2double(get(hObject,'String'));
2648 is_a_number = ~isnan(new_wse);
2649 is_positive = new_wse>=0;
2650 
2651 % Modify the Application data:
2652 % ----------------------------
2653 if is_a_number && is_positive
2654     guiparams.wse = new_wse;
2655     
2656     % Re-store the Application data:
2657     % ------------------------------
2658     setappdata(handles.figure1,'guiparams',guiparams)
2659     
2660 else % Reject the (incorrect) input
2661     set(hObject,'String',guiparams.wse)
2662 end
2663 
2664 % [EOF] WSE_Callback
2665 
2666 
2667 % --------------------------------------------------------------------
2668 function OutputAuxiliaryData_Callback(hObject, eventdata, handles)
2669 % Bathymetry Auxiliary Data
2670 
2671 % Get the Application data:
2672 % -------------------------
2673 guiparams = getappdata(handles.figure1,'guiparams');
2674 
2675 % Modify the Application data:
2676 % ----------------------------
2677 guiparams.output_auxiliary_data = logical(get(hObject,'Value')); % boolean
2678 
2679 % Re-store the Application data:
2680 % ------------------------------
2681 setappdata(handles.figure1,'guiparams',guiparams)
2682 
2683 % [EOF] OutputAuxiliaryData_Callback
2684 
2685 
2686 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2687 % PLOTTING/PLAN VIEW PLOT CALLBACKS %
2688 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2689 
2690 % --------------------------------------------------------------------
2691 function DepthRangeMin_Callback(hObject, eventdata, handles)
2692 
2693 % Get the Application data:
2694 % -------------------------
2695 guiparams = getappdata(handles.figure1,'guiparams');
2696 
2697 % Get the new entry and make sure it is valid (numeric, positive):
2698 % ----------------------------------------------------------------
2699 new_depth_range_min = str2double(get(hObject,'String'));
2700 is_a_number = ~isnan(new_depth_range_min);
2701 is_positive = new_depth_range_min>=0;
2702 
2703 % Modify the Application data:
2704 % ----------------------------
2705 if is_a_number && is_positive
2706     guiparams.depth_range_min = new_depth_range_min;
2707     
2708     % Re-store the Application data:
2709     % ------------------------------
2710     setappdata(handles.figure1,'guiparams',guiparams)
2711     
2712 else % Reject the (incorrect) input
2713     set(hObject,'String',guiparams.depth_range_min)
2714 end
2715 
2716 % [EOF] DepthRangeMin_Callback
2717 
2718 
2719 % --------------------------------------------------------------------
2720 function DepthRangeMax_Callback(hObject, eventdata, handles)
2721 
2722 % Get the Application data:
2723 % -------------------------
2724 guiparams = getappdata(handles.figure1,'guiparams');
2725 
2726 % Get the new entry and make sure it is valid (numeric, positive):
2727 % ----------------------------------------------------------------
2728 new_depth_range_max = str2double(get(hObject,'String'));
2729 is_a_number = ~isnan(new_depth_range_max);
2730 is_positive = new_depth_range_max>=0;
2731 
2732 % Modify the Application data:
2733 % ----------------------------
2734 if is_a_number && is_positive
2735     guiparams.depth_range_max = new_depth_range_max;
2736     
2737     % Re-store the Application data:
2738     % ------------------------------
2739     setappdata(handles.figure1,'guiparams',guiparams)
2740     
2741 else % Reject the (incorrect) input
2742     set(hObject,'String',guiparams.depth_range_max)
2743 end
2744 
2745 % [EOF] DepthMax_Callback
2746 
2747 
2748 % --------------------------------------------------------------------
2749 function VectorScalePlanView_Callback(hObject, eventdata, handles)
2750 % Set quiver scale (contour)
2751 
2752 % Get the Application data:
2753 % -------------------------
2754 guiparams = getappdata(handles.figure1,'guiparams');
2755 
2756 % Get the new entry and make sure it is valid (numeric, positive):
2757 % ----------------------------------------------------------------
2758 new_vector_scale_plan_view = str2double(get(hObject,'String'));
2759 is_a_number = ~isnan(new_vector_scale_plan_view);
2760 is_positive = new_vector_scale_plan_view>=0;
2761 
2762 % Modify the Application data:
2763 % ----------------------------
2764 if is_a_number && is_positive
2765     guiparams.vector_scale_plan_view = round(new_vector_scale_plan_view);
2766     
2767     % Re-store the Application data:
2768     % ------------------------------
2769     setappdata(handles.figure1,'guiparams',guiparams)
2770     
2771 else % Reject the (incorrect) input
2772     set(hObject,'String',guiparams.vector_scale_plan_view)
2773 end
2774 
2775 % [EOF] VectorScalePlanView_Callback
2776 
2777 
2778 % --------------------------------------------------------------------
2779 function VectorSpacingPlanview_Callback(hObject, eventdata, handles)
2780 % Set quiver spacing (contour, horizontal)
2781 
2782 % Get the Application data:
2783 % -------------------------
2784 guiparams = getappdata(handles.figure1,'guiparams');
2785 
2786 % Get the new entry and make sure it is valid (numeric, positive):
2787 % ----------------------------------------------------------------
2788 new_vector_spacing_plan_view = str2double(get(hObject,'String'));
2789 is_a_number = ~isnan(new_vector_spacing_plan_view);
2790 is_positive = new_vector_spacing_plan_view>=0;
2791 
2792 % Modify the Application data:
2793 % ----------------------------
2794 if is_a_number && is_positive
2795     guiparams.vector_spacing_plan_view = round(new_vector_spacing_plan_view);
2796     
2797     % Re-store the Application data:
2798     % ------------------------------
2799     setappdata(handles.figure1,'guiparams',guiparams)
2800     
2801 else % Reject the (incorrect) input
2802     set(hObject,'String',guiparams.vector_spacing_plan_view)
2803 end
2804 
2805 % [EOF] VectorSpacingPlanview_Callback
2806 
2807 
2808 % --------------------------------------------------------------------
2809 function SmoothingWindowSize_Callback(hObject, eventdata, handles)
2810 % Plan View smoothing window size
2811 
2812 % Get the Application data:
2813 % -------------------------
2814 guiparams = getappdata(handles.figure1,'guiparams');
2815 
2816 % Get the new entry and make sure it is valid (numeric, positive):
2817 % ----------------------------------------------------------------
2818 new_smoothing_window_size = str2double(get(hObject,'String'));
2819 is_a_number = ~isnan(new_smoothing_window_size);
2820 is_positive = new_smoothing_window_size>=0;
2821 
2822 % Modify the Application data:
2823 % ----------------------------
2824 if is_a_number && is_positive
2825     guiparams.smoothing_window_size = round(new_smoothing_window_size);
2826     
2827     % Re-store the Application data:
2828     % ------------------------------
2829     setappdata(handles.figure1,'guiparams',guiparams)
2830     
2831 else % Reject the (incorrect) input
2832     set(hObject,'String',guiparams.smoothing_window_size)
2833 end
2834 
2835 % [EOF] SmoothingWindowSize_Callback
2836 
2837 
2838 % --------------------------------------------------------------------
2839 function DisplayShoreline_Callback(hObject, eventdata, handles)
2840 
2841 % Get the Application data:
2842 % -------------------------
2843 guiparams = getappdata(handles.figure1,'guiparams');
2844 
2845 % Modify the Application data:
2846 % ----------------------------
2847 guiparams.display_shoreline = logical(get(hObject,'Value')); % boolean
2848 
2849 % Re-store the Application data:
2850 % ------------------------------
2851 setappdata(handles.figure1,'guiparams',guiparams)
2852 
2853 % [EOF] DisplayShoreline_Callback
2854 
2855 
2856 % --------------------------------------------------------------------
2857 function AddBackground_Callback(hObject, eventdata, handles)
2858 
2859 % Get the Application data:
2860 % -------------------------
2861 guiparams = getappdata(handles.figure1,'guiparams');
2862 
2863 % Modify the Application data:
2864 % ----------------------------
2865 guiparams.add_background = logical(get(hObject,'Value')); % boolean
2866 
2867 % Re-store the Application data:
2868 % ------------------------------
2869 setappdata(handles.figure1,'guiparams',guiparams)
2870 
2871 % [EOF] AddBackground_Callback
2872 
2873 
2874 % --------------------------------------------------------------------
2875 function PlotPlanView_Callback(hObject, eventdata, handles)
2876 planviewPlotCallback(hObject, eventdata, handles)
2877 % [EOF] PlotPlanView_Callback
2878 
2879 
2880 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2881 % PLOTTING/SHIP TRACKS PLOT CALLBACKS %
2882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2883 
2884 % --------------------------------------------------------------------
2885 function HorizontalGridNodeSpacing_Callback(hObject, eventdata, handles)
2886 % Set the horizontal grid node spacing
2887 
2888 % Get the Application data:
2889 % -------------------------
2890 guiparams = getappdata(handles.figure1,'guiparams');
2891 
2892 % Get the new entry and make sure it is valid (numeric, positive):
2893 % ----------------------------------------------------------------
2894 new_horizontal_grid_node_spacing = str2double(get(hObject,'String'));
2895 is_a_number = ~isnan(new_horizontal_grid_node_spacing);
2896 is_positive = new_horizontal_grid_node_spacing>=0;
2897 
2898 % Modify the Application data:
2899 % ----------------------------
2900 if is_a_number && is_positive
2901     guiparams.horizontal_grid_node_spacing = new_horizontal_grid_node_spacing;
2902     
2903     % Re-store the Application data:
2904     % ------------------------------
2905     setappdata(handles.figure1,'guiparams',guiparams)
2906     
2907 else % Reject the (incorrect) input
2908     set(hObject,'String',guiparams.horizontal_grid_node_spacing)
2909 end
2910 
2911 % [EOF] HorizontalGridNodeSpacing_Callback
2912 
2913 % --------------------------------------------------------------------
2914 function VerticalGridNodeSpacing_Callback(hObject, eventdata, handles)
2915 % Set the horizontal grid node spacing
2916 
2917 % Get the Application data:
2918 % -------------------------
2919 guiparams = getappdata(handles.figure1,'guiparams');
2920 
2921 % Get the new entry and make sure it is valid (numeric, positive):
2922 % ----------------------------------------------------------------
2923 new_vertical_grid_node_spacing = str2double(get(hObject,'String'));
2924 is_a_number = ~isnan(new_vertical_grid_node_spacing);
2925 is_positive = new_vertical_grid_node_spacing>=0;
2926 
2927 % Modify the Application data:
2928 % ----------------------------
2929 if is_a_number && is_positive
2930     guiparams.vertical_grid_node_spacing = new_vertical_grid_node_spacing;
2931     
2932     % Re-store the Application data:
2933     % ------------------------------
2934     setappdata(handles.figure1,'guiparams',guiparams)
2935     
2936 else % Reject the (incorrect) input
2937     set(hObject,'String',guiparams.vertical_grid_node_spacing)
2938 end
2939 
2940 % [EOF] VerticalGridNodeSpacing_Callback
2941 
2942 % --------------------------------------------------------------------
2943 function SetCrossSectionEndpoints_Callback(hObject, eventdata, handles)
2944 % Set the cross section endpoints manually
2945 
2946 % Get the Application data:
2947 % -------------------------
2948 guiparams = getappdata(handles.figure1,'guiparams');
2949 
2950 % Modify the Application data:
2951 % ----------------------------
2952 guiparams.set_cross_section_endpoints = logical(get(hObject,'Value')); % boolean
2953 
2954 % Re-store the Application data:
2955 % ------------------------------
2956 setappdata(handles.figure1,'guiparams',guiparams)
2957 
2958 % [EOF] SetCrossSectionEndpoints_Callback
2959 
2960 
2961 % --------------------------------------------------------------------
2962 function PlotShiptracks_Callback(hObject, eventdata, handles)
2963 shiptracksPlotCallback(hObject, eventdata, handles)
2964 % [EOF] PlotShiptracks_Callback
2965 
2966 
2967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2968 % PLOTTING/CROSS SECTION PLOT CALLBACKS %
2969 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2970 
2971 % --------------------------------------------------------------------
2972 function Contour_Callback(hObject, eventdata, handles)
2973 
2974 % Get the Application data:
2975 % -------------------------
2976 guiparams = getappdata(handles.figure1,'guiparams');
2977 
2978 % Modify the Application data:
2979 % ----------------------------
2980 idx_variable = get(hObject,'Value');
2981 guiparams.idx_contour = idx_variable;
2982 guiparams.contour = guiparams.contours(idx_variable).variable;
2983 
2984 % Re-store the Application data:
2985 % ------------------------------
2986 setappdata(handles.figure1,'guiparams',guiparams)
2987 
2988 % [EOF] Contour_Callback
2989 
2990 
2991 % --------------------------------------------------------------------
2992 function VerticalExaggeration_Callback(hObject, eventdata, handles)
2993 % Set vertical exaggeration
2994 
2995 % Get the Application data:
2996 % -------------------------
2997 guiparams = getappdata(handles.figure1,'guiparams');
2998 
2999 % Modify the Application data:
3000 % ----------------------------
3001 guiparams.vertical_exaggeration = str2double(get(hObject,'String'));
3002 
3003 % Re-store the Application data:
3004 % ------------------------------
3005 setappdata(handles.figure1,'guiparams',guiparams)
3006 
3007 % Update the GUI:
3008 % ---------------
3009 % updateGUI(handles,guiparams)
3010 
3011 % [EOF] VerticalExaggeration_Callback
3012 
3013 
3014 % --------------------------------------------------------------------
3015 function VectorScaleCrossSection_Callback(hObject, eventdata, handles)
3016 
3017 % Get the Application data:
3018 % -------------------------
3019 guiparams = getappdata(handles.figure1,'guiparams');
3020 
3021 % Modify the Application data:
3022 % ----------------------------
3023 guiparams.vector_scale_cross_section = str2double(get(hObject,'String'));
3024 
3025 % Re-store the Application data:
3026 % ------------------------------
3027 setappdata(handles.figure1,'guiparams',guiparams)
3028 
3029 % Update the GUI:
3030 % ---------------
3031 % updateGUI(handles,guiparams)
3032 
3033 % [EOF] VectorScaleCrossSection_Callback
3034 
3035 
3036 % --------------------------------------------------------------------
3037 function HorizontalVectorSpacing_Callback(hObject, eventdata, handles)
3038 
3039 % Get the Application data:
3040 % -------------------------
3041 guiparams = getappdata(handles.figure1,'guiparams');
3042 
3043 % Modify the Application data:
3044 % ----------------------------
3045 guiparams.horizontal_vector_spacing = str2double(get(hObject,'String'));
3046 
3047 % Re-store the Application data:
3048 % ------------------------------
3049 setappdata(handles.figure1,'guiparams',guiparams)
3050 
3051 % Update the GUI:
3052 % ---------------
3053 % updateGUI(handles,guiparams)
3054 
3055 % [EOF] HorizontalVectorSpacing_Callback
3056 
3057 
3058 % --------------------------------------------------------------------
3059 function VerticalVectorSpacing_Callback(hObject, eventdata, handles)
3060 % Get the vertical quiver spacing for contour plots
3061 
3062 % Get the Application data:
3063 % -------------------------
3064 guiparams = getappdata(handles.figure1,'guiparams');
3065 
3066 % Modify the Application data:
3067 % ----------------------------
3068 guiparams.vertical_vector_spacing = str2double(get(hObject,'String'));
3069 
3070 % Re-store the Application data:
3071 % ------------------------------
3072 setappdata(handles.figure1,'guiparams',guiparams)
3073 
3074 % Update the GUI:
3075 % ---------------
3076 % updateGUI(handles,guiparams)
3077 
3078 % [EOF] VerticalVectorSpacing_Callback
3079 
3080 
3081 % --------------------------------------------------------------------
3082 function HorizontalSmoothingWindow_Callback(hObject, eventdata, handles)
3083 % Horizontal Smoothing
3084 
3085 % Get the Application data:
3086 % -------------------------
3087 guiparams = getappdata(handles.figure1,'guiparams');
3088 
3089 % Modify the Application data:
3090 % ----------------------------
3091 guiparams.horizontal_smoothing_window = str2double(get(hObject,'String'));
3092 
3093 % Re-store the Application data:
3094 % ------------------------------
3095 setappdata(handles.figure1,'guiparams',guiparams)
3096 
3097 % Update the GUI:
3098 % ---------------
3099 % updateGUI(handles,guiparams)
3100 
3101 % [EOF] HorizontalSmoothingWindow_Callback
3102 
3103 
3104 % --------------------------------------------------------------------
3105 function VerticalSmoothingWindow_Callback(hObject, eventdata, handles)
3106 % Vertical Smoothing
3107 
3108 % Get the Application data:
3109 % -------------------------
3110 guiparams = getappdata(handles.figure1,'guiparams');
3111 
3112 % Modify the Application data:
3113 % ----------------------------
3114 guiparams.vertical_smoothing_window = str2double(get(hObject,'String'));
3115 
3116 % Re-store the Application data:
3117 % ------------------------------
3118 setappdata(handles.figure1,'guiparams',guiparams)
3119 
3120 % Update the GUI:
3121 % ---------------
3122 % updateGUI(handles,guiparams)
3123 
3124 % [EOF] VerticalSmoothingWindow_Callback
3125 
3126 
3127 % --------------------------------------------------------------------
3128 function PlotSecondaryFlowVectors_Callback(hObject, eventdata, handles)
3129 
3130 % Get the Application data:
3131 % -------------------------
3132 guiparams = getappdata(handles.figure1,'guiparams');
3133 
3134 % Modify the Application data:
3135 % ----------------------------
3136 guiparams.plot_secondary_flow_vectors = logical(get(hObject,'Value')); % boolean
3137 
3138 % Re-store the Application data:
3139 % ------------------------------
3140 setappdata(handles.figure1,'guiparams',guiparams)
3141 
3142 % [EOF] PlotSecondaryFlowVectors_Callback
3143 
3144 
3145 % --------------------------------------------------------------------
3146 function SecondaryFlowVectorVariable_Callback(hObject, eventdata, handles)
3147 
3148 % Get the Application data:
3149 % -------------------------
3150 guiparams = getappdata(handles.figure1,'guiparams');
3151 
3152 % Modify the Application data:
3153 % ----------------------------
3154 idx_variable = get(hObject,'Value');
3155 guiparams.idx_secondary_flow_vector_variable = idx_variable;
3156 guiparams.secondary_flow_vector_variable = guiparams.secondary_flows(idx_variable).variable;
3157 
3158 % Re-store the Application data:
3159 % ------------------------------
3160 setappdata(handles.figure1,'guiparams',guiparams)
3161 
3162 % [EOF] SecondaryFlowVectorVariable_Callback
3163 
3164 
3165 % --------------------------------------------------------------------
3166 function IncludeVerticalVelocity_Callback(hObject, eventdata, handles)
3167 
3168 % Get the Application data:
3169 % -------------------------
3170 guiparams = getappdata(handles.figure1,'guiparams');
3171 
3172 % Modify the Application data:
3173 % ----------------------------
3174 guiparams.include_vertical_velocity = logical(get(hObject,'Value')); % boolean
3175 
3176 % Re-store the Application data:
3177 % ------------------------------
3178 setappdata(handles.figure1,'guiparams',guiparams)
3179 
3180 % [EOF] IncludeVerticalVelocity_Callback
3181 
3182 
3183 % --------------------------------------------------------------------
3184 function PlotCrossSection_Callback(hObject, eventdata, handles)
3185 crosssectionPlotCallback(hObject, eventdata, handles)
3186 % [EOF] PlotCrossSection_Callback
3187 
3188 
3189 % --------------------------------------------------------------------
3190 function ClearLog_Callback(hObject, eventdata, handles)
3191 set(handles.LogWindow,'string','')
3192 % [EOF] ClearLog_Callback
3193 
3194 % --------------------------------------------------------------------
3195 function SaveLog_Callback(hObject, eventdata, handles)
3196 
3197 % Get the Application data:
3198 % -------------------------
3199 guiparams = getappdata(handles.figure1,'guiparams');
3200 guiprefs  = getappdata(handles.figure1,'guiprefs');
3201 % z   = guiparams.z;   %#ok<NASGU>
3202 % A   = guiparams.A;   %#ok<NASGU>
3203 % V   = guiparams.V;   %#ok<NASGU>
3204 % Map = guiparams.Map; %#ok<NASGU>
3205 
3206 [the_file,the_path] = ...
3207     uiputfile({'*.txt','TXT-Files (*.txt)'}, ...
3208     'Choose where to save the log file', ...
3209     fullfile(guiprefs.log_path,guiprefs.log_file));
3210 
3211 % Save the log to a TXT file:
3212 % ---------------------------
3213 if ischar(the_file)
3214     guiparams.log_path = the_path;
3215     guiparams.log_file = the_file;
3216     %guiparams.savefile = the_file;
3217     
3218     % Re-store the Application data:
3219     % ------------------------------
3220     setappdata(handles.figure1,'guiparams',guiparams)
3221     
3222     % Update the preferences:
3223     % -----------------------
3224     guiprefs = getappdata(handles.figure1,'guiprefs');
3225     guiprefs.log_path = the_path;
3226     guiprefs.log_file = the_file;
3227     setappdata(handles.figure1,'guiprefs',guiprefs)
3228     store_prefs(handles.figure1,'log')
3229     
3230     [~,filename,extension] = fileparts(the_file);
3231     savefile = [the_path filename extension];
3232     h = msgbox(['Saving log to: ''' savefile ''''], ...
3233         'Saving Log File...'); %#ok<NASGU>
3234     
3235     logfile = get(handles.LogWindow,'string');
3236     [nrows,~]= size(logfile);
3237     fid = fopen(savefile, 'w');
3238     for row=1:nrows
3239         fprintf(fid, '%s \n', logfile{row,:});
3240     end
3241     fclose(fid);
3242 end
3243 % [EOF] SaveLog_Callback
3244 
3245 %%%%%%%%%%%%%%%%
3246 % SUBFUNCTIONS %
3247 %%%%%%%%%%%%%%%%
3248 
3249 % --------------------------------------------------------------------
3250 function handles = buildToolbar(handles)
3251 
3252 icons = getIcons;
3253 ht = uitoolbar('Parent',handles.figure1);
3254 
3255 % Load data
3256 % icon = imread('C:\Users\pfricker\Desktop\icons\file_open.png');
3257 % icon = double(icon)/(2^16-1);
3258 % icon(icon==0) = NaN;
3259 handles.toolbarLoadData = ...
3260     uipushtool('Parent',       ht, ...
3261     'CData',        icons(1).data, ...
3262     'TooltipString','Open ASCII File');
3263 
3264 % Save data
3265 % icon = imread('C:\Users\pfricker\Desktop\icons\file_save.png');
3266 % icon = double(icon)/(2^16-1);
3267 % icon(icon==0) = NaN;
3268 handles.toolbarSaveMatFile = ...
3269     uipushtool('Parent',       ht, ...
3270     'CData',        icons(2).data, ...
3271     'TooltipString','Save MAT File', ...
3272     'Separator',    'on');
3273 
3274 
3275 % Save bathymetry
3276 %icon = ones(16,16,3);
3277 handles.toolbarSaveBathymetry = ...
3278     uipushtool('Parent',       ht, ...
3279     'CData',        icons(5).data, ...
3280     'TooltipString','Export Bathymetry');
3281 
3282 % Save figures
3283 % icon = ones(16,16,3);
3284 handles.toolbarSaveFigures = ...
3285     uipushtool('Parent',       ht, ...
3286     'CData',        icons(6).data, ...
3287     'TooltipString','Export Figures');
3288 
3289 % Save Excel File
3290 % icon = ones(16,16,3);
3291 handles.toolbarSaveExcel = ...
3292     uipushtool('Parent',       ht, ...
3293     'CData',        icons(7).data, ...
3294     'TooltipString','Export Excel File');
3295 
3296 
3297 % Plotting parameters
3298 % [icon,map] = imread('C:\Users\pfricker\Desktop\icons\PlotGeneralElement.gif');
3299 % icon = ind2rgb(icon,map);
3300 handles.toolbarPlottingParameters = ...
3301     uipushtool('Parent',       ht, ...
3302     'CData',        icons(3).data, ...
3303     'TooltipString','Plotting Parameters', ...
3304     'Separator',    'on');
3305 
3306 % Processing parameters
3307 % [icon,map] = imread('C:\Users\pfricker\Desktop\icons\ParameterIcon.gif');
3308 % icon = ind2rgb(icon,map);
3309 handles.toolbarProcessingParameters = ...
3310     uipushtool('Parent',       ht, ...
3311     'CData',        icons(4).data, ...
3312     'TooltipString','Processing Parameters');
3313 
3314 % Zoom In
3315 % [icon,map] = imread('C:\Users\pfricker\Desktop\icons\ParameterIcon.gif');
3316 % icon = ind2rgb(icon,map);
3317 % handles.toolbarZoomIn = ...
3318 %     uitoggletool('Parent',       ht, ...
3319 %     'CData',        icons(8).data, ...
3320 %     'TooltipString','Zoom In (Shiptracks)', ...
3321 %     'Separator',     'on');
3322 
3323 % Zoom Out
3324 % [icon,map] = imread('C:\Users\pfricker\Desktop\icons\ParameterIcon.gif');
3325 % icon = ind2rgb(icon,map);
3326 % handles.toolbarZoomOut = ...
3327 %     uitoggletool('Parent',       ht, ...
3328 %     'CData',        icons(9).data, ...
3329 %     'TooltipString','Zoom Out (Shiptracks)');
3330 
3331 % Pan
3332 % [icon,map] = imread('C:\Users\pfricker\Desktop\icons\ParameterIcon.gif');
3333 % icon = ind2rgb(icon,map);
3334 % handles.toolbarPan = ...
3335 %     uipushtool('Parent',       ht, ...
3336 %     'CData',        icons(10).data, ...
3337 %     'TooltipString','Pan (Shiptracks)');
3338 
3339 
3340 
3341 set(handles.toolbarLoadData,            'ClickedCallback',{@loadDataCallback,handles})
3342 set(handles.toolbarSaveMatFile,         'ClickedCallback',{@saveDataCallback,handles})
3343 set(handles.toolbarSaveBathymetry,      'ClickedCallback',{@ExportMultibeamBathymetry_Callback,handles})
3344 set(handles.toolbarSaveFigures,         'ClickedCallback',{@menuExportFigures_Callback,handles})
3345 set(handles.toolbarSaveExcel,           'ClickedCallback',{@menuSaveExcel_Callback,handles})
3346 set(handles.toolbarPlottingParameters,  'ClickedCallback',{@plottingParametersCallback,handles})
3347 set(handles.toolbarProcessingParameters,'ClickedCallback',{@processingParametersCallback,handles})
3348 % set(handles.toolbarZoomIn,              'ClickedCallback',{@ShiptracksZoom_Callback,handles})
3349 % set(handles.toolbarZoomOut,              'ClickedCallback',{@ShiptracksZoom_Callback,handles})
3350 % set(handles.toolbarPan,              'ClickedCallback',{@ShiptracksPan_Callback,handles})
3351 % set(handles.planviewPlot,        'ClickedCallback',{@planviewPlotCallback,handles})
3352 % set(handles.crosssectionPlot,    'ClickedCallback',{@crosssectionPlotCallback,handles})
3353 
3354 % [EOF] buildtoolbar
3355 
3356 
3357 % --------------------------------------------------------------------
3358 function load_prefs(hfigure)
3359 % Load the GUI preferences.  Also, initialize preferences if they don't
3360 % already exist.
3361 
3362 % Preferences:
3363 % 'ascii'                Path and filenames of current ASCII files
3364 % 'mat'                  Path and filename of current MAT file
3365 % 'tecplot'              Path and filename of last Tecplot file
3366 % 'kmz'                  Path and filename of last KMZ file
3367 % 'multibeambathymetry'  Path and filename of last Multibeam Bathymetry file
3368 % 'log'                  Path and filename of last Log file
3369 % 'iric'                 Path and filename of last iRic ANV file
3370 % 'excel'                Path and filename of last Excel file
3371 % 'aerial'               Path and filename of last Aerial file
3372 % 'shoreline'            Path and filename of last Shoreline file
3373 % 'renderer'             Default graphics renderer
3374 % 'units'                Default plotting units
3375 % 'runcounter'           Keeps a running tally of how many times VMT is
3376 %                        started
3377 
3378 % Originals
3379 % prefs = {'ascii2gispath' 'ascii2kmlpath' 'asciipath'   'doqqpath' ...
3380 %          'endspath'      'logpath'       'matpath'     'savedpath' ...
3381 %          'shorepath'     'stapath'       'ysidatapath' 'ysidatapath'};
3382 
3383 % ASCII
3384 if ispref('VMT','ascii')
3385     ascii = getpref('VMT','ascii');
3386     if exist(ascii.path,'dir')
3387         guiprefs.ascii_path = ascii.path;
3388     else
3389         guiprefs.ascii_path = pwd;
3390     end
3391     does_exist = false(1,length(ascii.file));
3392     for k = 1:length(ascii.file) % Check each file one-by-one
3393         does_exist(k) = exist(fullfile(ascii.path,ascii.file{k}),'file');
3394     end
3395     if any(does_exist)
3396         guiprefs.ascii_file = ascii.file(does_exist);
3397     else
3398         guiprefs.ascii_file = {''};
3399     end
3400 else % Initialize ASCII
3401     guiprefs.ascii_path = pwd;
3402     guiprefs.ascii_file = {''};
3403     
3404     ascii.path = pwd;
3405     ascii.file = {''};
3406     setpref('VMT','ascii',ascii)
3407 end
3408 
3409 % MAT
3410 if ispref('VMT','mat')
3411     mat = getpref('VMT','mat');
3412     if exist(mat.path,'dir')
3413         guiprefs.mat_path = mat.path;
3414     else
3415         guiprefs.mat_path = pwd;
3416     end
3417     
3418     if iscell(mat.file)
3419         if exist(fullfile(mat.path,mat.file{1}),'file')
3420             guiprefs.mat_file = mat.file;
3421         else
3422             guiprefs.mat_file = '';
3423         end
3424     else
3425         if exist(fullfile(mat.path,mat.file),'file')
3426             guiprefs.mat_file = mat.file;
3427         else
3428             guiprefs.mat_file = '';
3429         end
3430     end
3431 else % Initialize MAT
3432     guiprefs.mat_path = pwd;
3433     guiprefs.mat_file = '';
3434     
3435     mat.path = pwd;
3436     mat.file = '';
3437     setpref('VMT','mat',mat)
3438 end
3439 
3440 % TECPLOT
3441 if ispref('VMT','tecplot')
3442     tecplot = getpref('VMT','tecplot');
3443     if exist(tecplot.path,'dir')
3444         guiprefs.tecplot_path = tecplot.path;
3445     else
3446         guiprefs.tecplot_path = pwd;
3447     end
3448     if exist(fullfile(tecplot.path,tecplot.file),'file')
3449         guiprefs.tecplot_file = tecplot.file;
3450     else
3451         guiprefs.tecplot_file = '';
3452     end
3453 else % Initialize TECPLOT
3454     guiprefs.tecplot_path = pwd;
3455     guiprefs.tecplot_file = '';
3456     
3457     tecplot.path = pwd;
3458     tecplot.file = '';
3459     setpref('VMT','tecplot',tecplot)
3460 end
3461 
3462 % KMZ
3463 if ispref('VMT','kmz')
3464     kmz = getpref('VMT','kmz');
3465     if exist(kmz.path,'dir')
3466         guiprefs.kmz_path = kmz.path;
3467     else
3468         guiprefs.kmz_path = pwd;
3469     end
3470     if exist(fullfile(kmz.path,kmz.file),'file')
3471         guiprefs.kmz_file = kmz.file;
3472     else
3473         guiprefs.kmz_file = '';
3474     end
3475 else % Initialize KMZ
3476     guiprefs.kmz_path = pwd;
3477     guiprefs.kmz_file = '';
3478     
3479     kmz.path = pwd;
3480     kmz.file = '';
3481     setpref('VMT','kmz',kmz)
3482 end
3483 
3484 % MULTIBEAM BATHYMETRY
3485 if ispref('VMT','multibeambathymetry')
3486     multibeambathymetry = getpref('VMT','multibeambathymetry');
3487     if exist(multibeambathymetry.path,'dir')
3488         guiprefs.multibeambathymetry_path = multibeambathymetry.path;
3489     else
3490         guiprefs.multibeambathymetry_path = pwd;
3491     end
3492     if exist(fullfile(multibeambathymetry.path,multibeambathymetry.file),'file')
3493         guiprefs.multibeambathymetry_file = multibeambathymetry.file;
3494     else
3495         guiprefs.multibeambathymetry_file = '';
3496     end
3497 else % Initialize MULTIBEAM BATHYMETRY
3498     guiprefs.multibeambathymetry_path = pwd;
3499     guiprefs.multibeambathymetry_file = '';
3500     
3501     multibeambathymetry.path = pwd;
3502     multibeambathymetry.file = '';
3503     setpref('VMT','multibeambathymetry',multibeambathymetry)
3504 end
3505 
3506 % Log
3507 if ispref('VMT','log')
3508     log = getpref('VMT','log');
3509     if exist(log.path,'dir')
3510         guiprefs.log_path = log.path;
3511     else
3512         guiprefs.log_path = pwd;
3513     end
3514     if exist(fullfile(log.path,log.file),'file')
3515         guiprefs.log_file = log.file;
3516     else
3517         guiprefs.log_file = '';
3518     end
3519 else % Initialize Log
3520     guiprefs.log_path = pwd;
3521     guiprefs.log_file = '';
3522     
3523     log.path = pwd;
3524     log.file = '';
3525     setpref('VMT','log',log)
3526 end
3527 
3528 % iRic
3529 if ispref('VMT','iric')
3530     iric = getpref('VMT','iric');
3531     if exist(iric.path,'dir')
3532         guiprefs.iric_path = iric.path;
3533     else
3534         guiprefs.iric_path = pwd;
3535     end
3536     if exist(fullfile(iric.path,iric.file),'file')
3537         guiprefs.iric_file = iric.file;
3538     else
3539         guiprefs.iric_file = '';
3540     end
3541 else % Initialize Log
3542     guiprefs.iric_path = pwd;
3543     guiprefs.iric_file = '';
3544     
3545     iric.path = pwd;
3546     iric.file = '';
3547     setpref('VMT','iric',iric)
3548 end
3549 
3550 % excel
3551 if ispref('VMT','excel')
3552     excel = getpref('VMT','excel');
3553     if exist(excel.path,'dir')
3554         guiprefs.excel_path = excel.path;
3555     else
3556         guiprefs.excel_path = pwd;
3557     end
3558     if exist(fullfile(excel.path,excel.file),'file')
3559         guiprefs.excel_file = excel.file;
3560     else
3561         guiprefs.excel_file = '';
3562     end
3563 else % Initialize pref
3564     guiprefs.excel_path = pwd;
3565     guiprefs.excel_file = '';
3566     
3567     excel.path = pwd;
3568     excel.file = '';
3569     setpref('VMT','excel',excel)
3570 end
3571 
3572 % aerial
3573 if ispref('VMT','aerial')
3574     aerial = getpref('VMT','aerial');
3575     if exist(aerial.path,'dir')
3576         guiprefs.aerial_path = aerial.path;
3577     else
3578         guiprefs.aerial_path = pwd;
3579     end
3580     does_exist = false(1,length(aerial.file));
3581     if iscell(aerial.file)
3582     for k = 1:numel(aerial.file) % Check each file one-by-one
3583         does_exist(k) = exist(fullfile(aerial.path,aerial.file{k}),'file');
3584     end
3585     else
3586         does_exist = exist(fullfile(aerial.path,aerial.file),'file');
3587     end
3588     if any(does_exist)
3589         guiprefs.aerial_file = aerial.file;
3590     else
3591         guiprefs.aerial_file = {''};
3592     end
3593 else % Initialize aerial
3594     guiprefs.aerial_path = pwd;
3595     guiprefs.aerial_file = {''};
3596     
3597     aerial.path = pwd;
3598     aerial.file = {''};
3599     setpref('VMT','aerial',aerial)
3600 end
3601 
3602 % shoreline
3603 if ispref('VMT','shoreline')
3604     shoreline = getpref('VMT','shoreline');
3605     if exist(shoreline.path,'dir')
3606         guiprefs.shoreline_path = shoreline.path;
3607     else
3608         guiprefs.shoreline_path = pwd;
3609     end
3610     
3611     if iscell(shoreline.file)
3612         if exist(fullfile(shoreline.path,shoreline.file{1}),'file')
3613             guiprefs.shoreline_file = shoreline.file;
3614         else
3615             guiprefs.shoreline_file = '';
3616         end
3617     else
3618         if exist(fullfile(shoreline.path,shoreline.file),'file')
3619             guiprefs.shoreline_file = shoreline.file;
3620         else
3621             guiprefs.shoreline_file = '';
3622         end
3623     end
3624 else % Initialize shoreline
3625     guiprefs.shoreline_path = pwd;
3626     guiprefs.shoreline_file = '';
3627     
3628     shoreline.path = pwd;
3629     shoreline.file = '';
3630     setpref('VMT','shoreline',shoreline)
3631 end
3632 % guiprefs.presentation = true;
3633 % guiprefs.print        = false;
3634 
3635 % for k = 1:length(prefs)
3636 %     newpref = '';
3637 %     if ispref('VMT',prefs{k})
3638 %         stored_newpref = getpref('VMT',prefs{k});
3639 %         if exist(stored_newpref,'dir')
3640 %             newpref = stored_newpref;
3641 %         else
3642 %             setpref('VMT',prefs{k},newpref)
3643 %         end
3644 %     end
3645 %     guiprefs.(prefs{k}) = newpref;
3646 % end
3647 
3648 % RENDERER
3649 if ispref('VMT','renderer')
3650     renderer = getpref('VMT','renderer');
3651     guiprefs.renderer = renderer;
3652 else % Initialize RENDERER
3653     renderer           = 'OpenGL';
3654     guiprefs.renderer  = renderer;
3655     setpref('VMT','renderer',renderer)
3656 end
3657 
3658 % UNITS
3659 if ispref('VMT','units')
3660     units = getpref('VMT','units');
3661     guiprefs.units = units;
3662 else % Initialize RENDERER
3663     units           = 'metric';
3664     guiprefs.units  = renderer;
3665     setpref('VMT','units',units)
3666 end
3667 
3668 % RUNCOUNTER
3669 if ispref('VMT','runcounter')
3670     runcounter = getpref('VMT','runcounter')+1;
3671     guiprefs.runcounter = runcounter;
3672 else % Initialize RENDERER
3673     runcounter           = 1;
3674     guiprefs.runcounter  = runcounter;
3675     setpref('VMT','runcounter',runcounter)
3676 end
3677 setappdata(hfigure,'guiprefs',guiprefs)
3678 
3679 % [EOF] load_prefs
3680 
3681 
3682 % --------------------------------------------------------------------
3683 function store_prefs(hfigure,pref)
3684 % Store preferences in the Application data and in the persistent
3685 % preferences data.
3686 
3687 % Preferences:
3688 % 'ascii'                Path and filenames of current ASCII files
3689 % 'mat'                  Path and filename of current MAT file
3690 % 'tecplot'              Path and filename of last Tecplot file
3691 % 'kmz'                  Path and filename of last KMZ file
3692 % 'multibeambathymetry'  Path and filename of last Multibeam Bathymetry file
3693 % 'log'                  Path and filename of last Log file
3694 % 'iric'                 Path and filename of last iRic ANV file
3695 % 'excel'                Path and filename of last Excel file
3696 % 'aerial'               Path and filename of last Aerial file
3697 % 'shoreline'            Path and filename of last Shoreline file
3698 % 'renderer'             Default graphics renderer
3699 % 'units'                Default plotting units
3700 % 'runcounter'           Keeps a running tally of how many times VMT is
3701 %                        started
3702 
3703 guiprefs = getappdata(hfigure,'guiprefs');
3704 
3705 switch pref
3706     case 'ascii'
3707         ascii.path = guiprefs.ascii_path;
3708         ascii.file = guiprefs.ascii_file;
3709         setpref('VMT','ascii',ascii)
3710     case 'mat'
3711         mat.path = guiprefs.mat_path;
3712         mat.file = guiprefs.mat_file;
3713         setpref('VMT','mat',mat)
3714     case 'tecplot'
3715         tecplot.path = guiprefs.tecplot_path;
3716         tecplot.file = guiprefs.tecplot_file;
3717         setpref('VMT','tecplot',tecplot)
3718     case 'kmz'
3719         kmz.path = guiprefs.kmz_path;
3720         kmz.file = guiprefs.kmz_file;
3721         setpref('VMT','kmz',kmz)
3722     case 'multibeambathymetry'
3723         multibeambathymetry.path = guiprefs.multibeambathymetry_path;
3724         multibeambathymetry.file = guiprefs.multibeambathymetry_file;
3725         setpref('VMT','multibeambathymetry',multibeambathymetry)
3726     case 'log'
3727         log.path = guiprefs.log_path;
3728         log.file = guiprefs.log_file;
3729         setpref('VMT','log',log)
3730     case 'iric'
3731         iric.path = guiprefs.iric_path;
3732         iric.file = guiprefs.iric_file;
3733         setpref('VMT','iric',iric)
3734     case 'excel'
3735         excel.path = guiprefs.excel_path;
3736         excel.file = guiprefs.excel_file;
3737         setpref('VMT','excel',excel)
3738     case 'aerial'
3739         aerial.path = guiprefs.aerial_path;
3740         aerial.file = guiprefs.aerial_file;
3741         setpref('VMT','aerial',aerial)
3742     case 'shoreline'
3743         shoreline.path = guiprefs.shoreline_path;
3744         shoreline.file = guiprefs.shoreline_file;
3745         setpref('VMT','shoreline',shoreline)
3746     case 'renderer'
3747         renderer = guiprefs.renderer;
3748         setpref('VMT','renderer',renderer)
3749     case 'units'
3750         units = guiprefs.units;
3751         setpref('VMT','units',units)
3752     case 'runcounter'
3753         runcounter = guiprefs.runcounter;
3754         setpref('VMT','runcounter',runcounter)
3755     otherwise
3756 end
3757 
3758 % if ismember(pref,prefs)
3759 %     setpref('VMT',pref,value)
3760 %
3761 %     guiprefs = getappdata(hfigure,'guiprefs');
3762 %     guiprefs.(pref) = value;
3763 %     setappdata(hfigure,'guiprefs',guiprefs)
3764 % end
3765 
3766 % [EOF] store_prefs
3767 
3768 
3769 % --------------------------------------------------------------------
3770 function initGUI(handles)
3771 % Initialize the UI controls in the GUI.
3772 
3773 guiparams = getappdata(handles.figure1,'guiparams');
3774 
3775 % Set the name and version
3776 set(handles.figure1,'Name',['Velocity Mapping Toolbox (VMT) ' guiparams.vmt_version], ...
3777     'DockControls','off')
3778 %set(handles.VMTversion,             'String',guiparams.vmt_version)
3779 
3780 % Set the PLOT 1 axis labels
3781 axes(handles.Plot1Shiptracks);
3782 set(handles.Plot1Shiptracks,'DataAspectRatio',[1 1 1],'PlotBoxAspectRatio',[1 1 1])
3783 xlabel('UTM Easting (m)')
3784 ylabel('UTM Northing (m)')
3785 box on
3786 grid on
3787 % ticks_format('%6.0f','%8.0f'); %formats the ticks for UTM
3788 
3789 %%%%%%%%%%%%
3790 % MENU BAR %
3791 %%%%%%%%%%%%
3792 if guiparams.english_units
3793     set(handles.menuMetric, 'Checked','off')
3794     set(handles.menuEnglish,'Checked','on')
3795 else
3796     set(handles.menuMetric, 'Checked','on')
3797     set(handles.menuEnglish,'Checked','off')
3798 end
3799 
3800 if guiparams.set_cross_section_endpoints
3801     set(handles.menuCrossSectionEndpointAutomatic,'Checked','off')
3802     set(handles.menuCrossSectionEndpointManual,   'Checked','on')
3803 else
3804     set(handles.menuCrossSectionEndpointAutomatic,'Checked','on')
3805     set(handles.menuCrossSectionEndpointManual,   'Checked','off')
3806 end
3807 
3808 
3809 if guiparams.print
3810     set(handles.menuPrintFormat,       'Checked','on')
3811     set(handles.menuPresentationFormat,'Checked','off')
3812     set(handles.menuStylePrint,        'Checked','on')
3813     set(handles.menuStylePresentation, 'Checked','off')
3814 elseif guiparams.presentation
3815     set(handles.menuPrintFormat,       'Checked','off')
3816     set(handles.menuPresentationFormat,'Checked','on')
3817     set(handles.menuStylePrint,        'Checked','off')
3818     set(handles.menuStylePresentation, 'Checked','on')
3819 else
3820 end
3821 
3822 switch guiparams.renderer
3823     case 'OpenGL'
3824         set(handles.menuOpenGL,        'Checked','on')
3825         set(handles.menuPainters,      'Checked','off')
3826         set(handles.menuZbuffer,       'Checked','off')
3827     case 'painters'
3828         set(handles.menuOpenGL,        'Checked','off')
3829         set(handles.menuPainters,      'Checked','on')
3830         set(handles.menuZbuffer,       'Checked','off')
3831     case 'zbuffer'
3832         set(handles.menuOpenGL,        'Checked','off')
3833         set(handles.menuPainters,      'Checked','off')
3834         set(handles.menuZbuffer,       'Checked','on')
3835 end
3836 
3837 
3838 %%%%%%%%%%%%%%%
3839 % DATA EXPORT %
3840 %%%%%%%%%%%%%%%
3841 % BathymetryPanel
3842 % set(handles.BeamAngle,                  'String',guiparams.beam_angle)
3843 % set(handles.MagneticVariation,          'String',guiparams.magnetic_variation)
3844 % set(handles.WSE,                        'String',guiparams.wse)
3845 % set(handles.OutputAuxiliaryData,        'Value', guiparams.output_auxiliary_data)
3846 
3847 %%%%%%%%%%%%%%%%%%%%%%
3848 % PLOTTING/PLAN VIEW %
3849 %%%%%%%%%%%%%%%%%%%%%%
3850 % PlanViewPanel
3851 set(handles.DepthRangeMin,              'String',guiparams.depth_range_min)
3852 set(handles.DepthRangeMax,              'String',guiparams.depth_range_max)
3853 set(handles.VectorScalePlanView,        'String',guiparams.vector_scale_plan_view)
3854 set(handles.VectorSpacingPlanview,      'String',guiparams.vector_spacing_plan_view)
3855 set(handles.SmoothingWindowSize,        'String',guiparams.smoothing_window_size)
3856 set(handles.DisplayShoreline,           'Value', guiparams.display_shoreline)
3857 set(handles.AddBackground,              'Value', guiparams.add_background)
3858 
3859 %%%%%%%%%%%%%%%%%%%%%%%%
3860 % PLOTTING/SHIP TRACKS %
3861 %%%%%%%%%%%%%%%%%%%%%%%%
3862 % ShiptracksPanel
3863 set(handles.HorizontalGridNodeSpacing,  'String',guiparams.horizontal_grid_node_spacing)
3864 set(handles.VerticalGridNodeSpacing,    'String',guiparams.vertical_grid_node_spacing)
3865 %set(handles.SetCrossSectionEndpoints,   'Value', guiparams.set_cross_section_endpoints)
3866 
3867 %%%%%%%%%%%%%%%%%%%%%%%%%%%
3868 % PLOTTING/CROSS SECTIONS %
3869 %%%%%%%%%%%%%%%%%%%%%%%%%%%
3870 % CrossSectionsPanel
3871 set(handles.Contour,                    'String',{guiparams.contours.string}, ...
3872     'Value', guiparams.idx_contour)
3873 set(handles.VerticalExaggeration,       'String',guiparams.vertical_exaggeration)
3874 set(handles.VectorScaleCrossSection,    'String',guiparams.vector_scale_cross_section)
3875 set(handles.HorizontalVectorSpacing,    'String',guiparams.horizontal_vector_spacing)
3876 set(handles.VerticalVectorSpacing,      'String',guiparams.vertical_vector_spacing)
3877 set(handles.HorizontalSmoothingWindow,  'String',guiparams.horizontal_smoothing_window)
3878 set(handles.VerticalSmoothingWindow,    'String',guiparams.vertical_smoothing_window)
3879 set(handles.PlotSecondaryFlowVectors,   'Value', guiparams.plot_secondary_flow_vectors)
3880 set(handles.SecondaryFlowVectorVariable,'String',{guiparams.secondary_flows.string}, ...
3881     'Value', guiparams.idx_secondary_flow_vector_variable)
3882 set(handles.IncludeVerticalVelocity,    'Value', guiparams.include_vertical_velocity)
3883 
3884 % set(handles.EnglishUnits,               'Value',guiparams.english_units)
3885 
3886 % [EOF] initGUI
3887 
3888 
3889 % --------------------------------------------------------------------
3890 function set_enable(handles,enable_state)
3891 
3892 guiparams = getappdata(handles.figure1,'guiparams');
3893 
3894 switch enable_state
3895     case 'init'
3896         guiparams.gui_state = 'init';
3897         set([handles.menuFile
3898             handles.menuOpen
3899             handles.menuOpenASCII
3900             handles.menuOpenMAT
3901             ],'Enable','on')
3902         
3903         set([handles.toolbarLoadData
3904             ],'Enable','on')
3905         set([handles.toolbarSaveMatFile
3906             handles.toolbarSaveBathymetry
3907             handles.toolbarSaveFigures
3908             handles.toolbarSaveExcel
3909             handles.toolbarPlottingParameters
3910             handles.toolbarProcessingParameters
3911             ],'Enable','off')
3912         
3913         set([handles.DepthRangeMin
3914             handles.DepthRangeMax
3915             handles.VectorScalePlanView
3916             handles.VectorSpacingPlanview
3917             handles.SmoothingWindowSize
3918             handles.DisplayShoreline
3919             handles.AddBackground
3920             handles.PlotPlanView
3921             ],'Enable','off')
3922         
3923         set([handles.HorizontalGridNodeSpacing
3924             handles.VerticalGridNodeSpacing
3925             handles.PlotShiptracks
3926             ],'Enable','off')
3927         
3928         set([handles.Contour
3929             handles.VerticalExaggeration
3930             handles.VectorScaleCrossSection
3931             handles.HorizontalVectorSpacing
3932             handles.VerticalVectorSpacing
3933             handles.HorizontalSmoothingWindow
3934             handles.VerticalSmoothingWindow
3935             handles.PlotSecondaryFlowVectors
3936             handles.SecondaryFlowVectorVariable
3937             handles.IncludeVerticalVelocity
3938             handles.PlotCrossSection
3939             ],'Enable','off')
3940         
3941     case 'fileloaded'
3942         guiparams.gui_state = 'fileloaded';
3943         set([handles.menuFile
3944             handles.menuOpen
3945             handles.menuOpenASCII
3946             handles.menuOpenMAT
3947             handles.menuSaveMAT
3948             handles.menuSaveTecplot
3949             handles.menuSaveKMZFile
3950             handles.menuParameters
3951             handles.menuPlottingParameters
3952             handles.menuMetric
3953             handles.menuEnglish
3954             handles.menuBathymetryExportSettings
3955             handles.menuExportMultibeamBathymetry
3956             handles.menuKMZVerticalOffset
3957             ],'Enable','on')
3958         
3959         set([handles.toolbarLoadData
3960             handles.toolbarSaveMatFile
3961             handles.toolbarSaveBathymetry
3962             handles.toolbarSaveExcel
3963             handles.toolbarSaveFigures
3964             handles.toolbarPlottingParameters
3965             ],'Enable','on')
3966         set([handles.toolbarProcessingParameters
3967             ],'Enable','off')
3968         
3969            
3970         set([handles.DepthRangeMin
3971             handles.DepthRangeMax
3972             handles.VectorScalePlanView
3973             handles.VectorSpacingPlanview
3974             handles.SmoothingWindowSize
3975             handles.DisplayShoreline
3976             handles.PlotPlanView
3977             ],'Enable','on')
3978         if guiparams.has_mapping_toolbox
3979             set(handles.AddBackground,'Enable','on')
3980         else
3981             set(handles.AddBackground,'Enable','off')
3982         end
3983         
3984         set([handles.HorizontalGridNodeSpacing
3985             handles.VerticalGridNodeSpacing
3986             handles.PlotShiptracks
3987             ],'Enable','on')
3988         
3989         set([handles.Contour
3990             handles.VerticalExaggeration
3991             handles.VectorScaleCrossSection
3992             handles.HorizontalVectorSpacing
3993             handles.VerticalVectorSpacing
3994             handles.HorizontalSmoothingWindow
3995             handles.VerticalSmoothingWindow
3996             handles.PlotSecondaryFlowVectors
3997             handles.SecondaryFlowVectorVariable
3998             handles.IncludeVerticalVelocity
3999             handles.PlotCrossSection
4000             ],'Enable','on')
4001     case 'multiplematfiles'
4002         guiparams.gui_state = 'multiplematfiles';
4003         set([handles.menuFile
4004             handles.menuOpen
4005             handles.menuOpenASCII
4006             handles.menuOpenMAT
4007             handles.menuParameters
4008             handles.menuPlottingParameters
4009             handles.menuMetric
4010             handles.menuEnglish
4011             ],'Enable','on')
4012         set([handles.menuSaveMAT
4013             handles.menuBathymetryExportSettings
4014             handles.menuExportMultibeamBathymetry
4015             handles.menuKMZVerticalOffset
4016             handles.menuSaveKMZFile
4017             handles.menuSaveTecplot
4018             ],'Enable','off')
4019         
4020         set([handles.toolbarLoadData
4021             handles.toolbarSaveFigures
4022             handles.toolbarPlottingParameters
4023             handles.toolbarSaveExcel
4024             ],'Enable','on')
4025         set([handles.toolbarProcessingParameters
4026             handles.toolbarSaveMatFile
4027             handles.toolbarSaveBathymetry
4028             ],'Enable','off')
4029         
4030         set([handles.DepthRangeMin
4031             handles.DepthRangeMax
4032             handles.VectorScalePlanView
4033             handles.VectorSpacingPlanview
4034             handles.SmoothingWindowSize
4035             handles.DisplayShoreline
4036             handles.PlotPlanView
4037             ],'Enable','on')
4038         if guiparams.has_mapping_toolbox
4039             set(handles.AddBackground,'Enable','on')
4040         else
4041             set(handles.AddBackground,'Enable','off')
4042         end
4043         
4044         set([handles.HorizontalGridNodeSpacing
4045             handles.VerticalGridNodeSpacing
4046             handles.PlotShiptracks
4047             ],'Enable','off')
4048         
4049         set([handles.Contour
4050             handles.VerticalExaggeration
4051             handles.VectorScaleCrossSection
4052             handles.HorizontalVectorSpacing
4053             handles.VerticalVectorSpacing
4054             handles.HorizontalSmoothingWindow
4055             handles.VerticalSmoothingWindow
4056             handles.PlotSecondaryFlowVectors
4057             handles.SecondaryFlowVectorVariable
4058             handles.IncludeVerticalVelocity
4059             handles.PlotCrossSection
4060             ],'Enable','off')
4061     otherwise
4062 end
4063 
4064 % Save Application Data
4065 setappdata(handles.figure1,'guiparams',guiparams)
4066 
4067 % [EOF] set_enable
4068 
4069 %% Compute the longitudinal dispersion coefficient
4070 
4071 %% --- Executes on button press in zerosecq_chkbox.
4072 %function zerosecq_chkbox_Callback(hObject, eventdata, handles)
4073 % hObject    handle to zerosecq_chkbox (see GCBO)
4074 % eventdata  reserved - to be defined in a future version of MATLAB
4075 % handles    structure with handles and user data (see GUIDATA)
4076 
4077 % Hint: get(hObject,'Value') returns toggle state of zerosecq_chkbox
4078 
4079 
4080 % --------------------------------------------------------------------
4081 function [english_units,set_cross_section_endpoints,plot_presentation_style,plot_print_style] = ...
4082     plotParametersDialog(english_units,set_cross_section_endpoints,plot_presentation_style,plot_print_style,hf)
4083 
4084 w = 500;
4085 h = 110;
4086 dx = 10;
4087 dy = 35;
4088 the_color = get(0,'factoryUipanelBackgroundColor');
4089 handles.Figure = figure('Name', 'Plotting Parameters', ...
4090     'Color',the_color, ...
4091     'NumberTitle','off', ...
4092     'HandleVisibility','callback', ...
4093     'WindowStyle','modal', ...
4094     'MenuBar','none', ...
4095     'ToolBar','none', ...
4096     'Units','pixels', ...
4097     'Position',[0 0 w h], ...
4098     'Resize','off', ...
4099     'Visible','off');
4100 dialog_params.english_units               = english_units;
4101 dialog_params.set_cross_section_endpoints = set_cross_section_endpoints;
4102 dialog_params.presentation                = plot_presentation_style; %presentation;
4103 dialog_params.print                       = plot_print_style; %print;
4104 setappdata(handles.Figure,'dialog_params',dialog_params)
4105 setappdata(handles.Figure,'original_dialog_params',dialog_params)
4106 
4107 % Build the graphics:
4108 % -------------------
4109 handles.UnitsPanel = uipanel('Parent',handles.Figure, ...
4110     'Title', 'Units', ...
4111     'Units','pixels', ...
4112     'Position',[dx dy (w-3*dx)/3 h-dx-dy+10]);
4113 handles.UnitsMetric = uicontrol('Style','checkbox', ...
4114     'Parent',handles.UnitsPanel, ...
4115     'String','Metric', ...
4116     'Units','pixels', ...
4117     'Position',[15 35 100 22]);
4118 handles.UnitsEnglish = uicontrol('Style','checkbox', ...
4119     'Parent',handles.UnitsPanel, ...
4120     'String','English', ...
4121     'Units','pixels', ...
4122     'Position',[15 10 100 22]);
4123 
4124 handles.EndpointsPanel = uipanel('Parent',handles.Figure, ...
4125     'Title', 'Cross-Section Endpoints', ...
4126     'Units','pixels', ...
4127     'Position',[(w+dx)/3 dy (w-3*dx)/3 h-dx-dy+10]);
4128 handles.EndpointsAutomatic = uicontrol('Style','checkbox', ...
4129     'Parent',handles.EndpointsPanel, ...
4130     'String','Automatic', ...
4131     'Units','pixels', ...
4132     'Position',[15 35 100 22]);
4133 handles.EndpointsManual = uicontrol('Style','checkbox', ...
4134     'Parent',handles.EndpointsPanel, ...
4135     'String','Set Manually', ...
4136     'Units','pixels', ...
4137     'Position',[15 10 100 22]);
4138 
4139 handles.StylePanel = uipanel('Parent',handles.Figure, ...
4140     'Title', 'Plot Style', ...
4141     'Units','pixels', ...
4142     'Position',[w-w/3 dy (w-3*dx)/3 h-dx-dy+10]);
4143 handles.StylePresentation = uicontrol('Style','checkbox', ...
4144     'Parent',handles.StylePanel, ...
4145     'String','Presentation', ...
4146     'Units','pixels', ...
4147     'Position',[15 35 100 22]);
4148 handles.StylePrint = uicontrol('Style','checkbox', ...
4149     'Parent',handles.StylePanel, ...
4150     'String','Print', ...
4151     'Units','pixels', ...
4152     'Position',[15 10 100 22]);
4153 
4154 handles.OK = uicontrol('Style',   'pushbutton', ...
4155     'Parent',  handles.Figure, ...
4156     'String',  'OK', ...
4157     'Units',   'pixels', ...
4158     'Position',[w/2-80-dx/4 6 80 22]);
4159 handles.Cancel = uicontrol('Style',   'pushbutton', ...
4160     'Parent',  handles.Figure, ...
4161     'String',  'Cancel', ...
4162     'Units',   'pixels', ...
4163     'Position',[w/2+dx/4 6 80 22]);
4164 
4165 % Update the UI controls:
4166 % -----------------------
4167 if dialog_params.english_units
4168     set(handles.UnitsMetric, 'Value',0)
4169     set(handles.UnitsEnglish,'Value',1)
4170 else
4171     set(handles.UnitsMetric, 'Value',1)
4172     set(handles.UnitsEnglish,'Value',0)
4173 end
4174 if dialog_params.set_cross_section_endpoints
4175     set(handles.EndpointsAutomatic,'Value',0)
4176     set(handles.EndpointsManual,   'Value',1)
4177 else
4178     set(handles.EndpointsAutomatic,'Value',1)
4179     set(handles.EndpointsManual,   'Value',0)
4180 end
4181 if dialog_params.presentation
4182     set(handles.StylePresentation, 'Value',1)
4183     set(handles.StylePrint,        'Value',0)
4184 else
4185     set(handles.StylePresentation, 'Value',0)
4186     set(handles.StylePrint,        'Value',1)
4187 end
4188 
4189 % Set the callbacks:
4190 % ------------------
4191 set(handles.Figure,            'CloseRequestFcn',{@dialogCloseReq, handles.OK})
4192 set(handles.UnitsMetric,       'Callback',       {@dialogUnits,    handles,'metric'})
4193 set(handles.UnitsEnglish,      'Callback',       {@dialogUnits,    handles,'english'})
4194 set(handles.EndpointsAutomatic,'Callback',       {@dialogEnpoints, handles,'auto'})
4195 set(handles.EndpointsManual,   'Callback',       {@dialogEnpoints, handles,'manual'})
4196 set(handles.StylePresentation, 'Callback',       {@dialogPlotStyle,handles,'presentation'})
4197 set(handles.StylePrint,        'Callback',       {@dialogPlotStyle,handles,'print'})
4198 set(handles.OK,                'Callback',       {@dialogOK,       handles.OK})
4199 set(handles.Cancel,            'Callback',       {@dialogCancel,   handles})
4200 
4201 % Position the dialog and make it visible:
4202 % ----------------------------------------
4203 fpos = get(hf,'Position');
4204 dpos = [(fpos(1) + fpos(3)/2 -w/2) (fpos(2) + fpos(4)/2)];
4205 movegui(handles.Figure,dpos)
4206 set(handles.Figure,'Visible','on')
4207 
4208 % Hold the dialog open:
4209 % ---------------------
4210 waitfor(handles.OK)
4211 
4212 % Return the outputs and close the dialog:
4213 % ----------------------------------------
4214 dialog_params = getappdata(handles.Figure,'dialog_params');
4215 english_units = dialog_params.english_units;
4216 set_cross_section_endpoints = dialog_params.set_cross_section_endpoints;
4217 plot_presentation_style =  dialog_params.presentation;
4218 plot_print_style =  dialog_params.print;
4219 
4220 delete(handles.Figure)
4221 
4222 % [EOF] plotParametersDialog
4223 
4224 
4225 % --------------------------------------------------------------------
4226 function dialogUnits(hObject,eventdata,handles,the_units)
4227 
4228 dialog_params = getappdata(handles.Figure,'dialog_params');
4229 switch the_units
4230     case 'metric'
4231         dialog_params.english_units = false;
4232         
4233         set(handles.UnitsMetric, 'Value',1)
4234         set(handles.UnitsEnglish,'Value',0)
4235     case 'english'
4236         dialog_params.english_units = true;
4237         
4238         set(handles.UnitsMetric, 'Value',0)
4239         set(handles.UnitsEnglish,'Value',1)
4240     otherwise
4241 end
4242 setappdata(handles.Figure,'dialog_params',dialog_params)
4243 
4244 % [EOF] dialogUnits
4245 
4246 % --------------------------------------------------------------------
4247 function dialogEnpoints(hObject,eventdata,handles,the_endpoints)
4248 
4249 dialog_params = getappdata(handles.Figure,'dialog_params');
4250 switch the_endpoints
4251     case 'auto'
4252         dialog_params.set_cross_section_endpoints = false;
4253         
4254         set(handles.EndpointsAutomatic,'Value',1)
4255         set(handles.EndpointsManual,   'Value',0)
4256     case 'manual'
4257         dialog_params.set_cross_section_endpoints = true;
4258         
4259         set(handles.EndpointsAutomatic,'Value',0)
4260         set(handles.EndpointsManual,   'Value',1)
4261     otherwise
4262 end
4263 setappdata(handles.Figure,'dialog_params',dialog_params)
4264 
4265 % [EOF] dialogEnpoints
4266 
4267 function dialogPlotStyle(hObject,eventdata,handles,the_style)
4268 
4269 dialog_params = getappdata(handles.Figure,'dialog_params');
4270 switch the_style
4271     case 'presentation'
4272         dialog_params.presentation  = true;
4273         dialog_params.print         = false;
4274         
4275         set(handles.StylePresentation,'Value',1)
4276         set(handles.StylePrint,       'Value',0)
4277     case 'print'
4278         dialog_params.presentation  = false;
4279         dialog_params.print         = true;
4280         
4281         set(handles.StylePresentation,'Value',0)
4282         set(handles.StylePrint,       'Value',1)
4283     otherwise
4284 end
4285 setappdata(handles.Figure,'dialog_params',dialog_params)
4286 
4287 % [EOF] dialogEnpoints
4288 
4289 % --------------------------------------------------------------------
4290 function dialogOK(hObject,eventdata,h_OK)
4291 
4292 delete(h_OK)
4293 
4294 % [EOF] dialogOK
4295 
4296 % --------------------------------------------------------------------
4297 function dialogCancel(hObject,eventdata,handles)
4298 % Return the original inputs
4299 dialog_params = getappdata(handles.Figure,'original_dialog_params');
4300 setappdata(handles.Figure,'dialog_params',dialog_params)
4301 delete(handles.OK)
4302 
4303 % [EOF] dialogCancel
4304 
4305 % --------------------------------------------------------------------
4306 function dialogCloseReq(hObject,eventdata,h_OK)
4307 
4308 delete(h_OK)
4309 
4310 % [EOF] dialogCloseReq
4311 
4312 function [beam_angle,magnetic_variation,wse,output_auxiliary_data] = exportSettingsDialog(beam_angle,magnetic_variation,wse,output_auxiliary_data,hf)
4313 w = 230;
4314 h = 200;
4315 dx = 10;
4316 dy = 35;
4317 the_color = get(0,'factoryUipanelBackgroundColor');
4318 handles.Figure = figure('Name', 'Export Settings', ...
4319     'Color',the_color, ...
4320     'NumberTitle','off', ...
4321     'HandleVisibility','callback', ...
4322     'WindowStyle','modal', ...
4323     'MenuBar','none', ...
4324     'ToolBar','none', ...
4325     'Units','pixels', ...
4326     'Position',[0 0 w h], ...
4327     'Resize','off', ...
4328     'Visible','off');
4329 dialog_params.beam_angle             = beam_angle;
4330 dialog_params.magnetic_variation     = magnetic_variation;
4331 dialog_params.wse                    = wse;
4332 dialog_params.output_auxiliary_data = output_auxiliary_data;
4333 setappdata(handles.Figure,'dialog_params',dialog_params)
4334 setappdata(handles.Figure,'original_dialog_params',dialog_params)
4335 
4336 % Build the graphics:
4337 % -------------------
4338 ph = 150;
4339 handles.BathymetryPanel = uipanel('Parent',handles.Figure, ...
4340     'Title', 'Bathymetry', ...
4341     'Units','pixels', ...
4342     'Position',[dx dy (w-2*dx) h-dx-dy+10]);
4343 handles.BeamAngleText = uicontrol('Style','text', ...
4344     'Parent',handles.BathymetryPanel, ...
4345     'String','Beam Angle (deg)', ...
4346     ...'Value',beam_angle,...
4347     'HorizontalAlignment','right',...
4348     'Units','pixels', ...
4349     'Position',[dx+5 h-ph+60-4 100 22]);
4350 handles.BeamAngle = uicontrol('Style','edit', ...
4351     'Parent',handles.BathymetryPanel, ...
4352     ...'String','Beam Angle (deg)', ...
4353     'String',beam_angle,...
4354     'BackgroundColor','w',...
4355     'Units','pixels', ...
4356     'Position',[w-dx-80 h-ph+60 50 22]);
4357 handles.MagneticVariationText = uicontrol('Style','text', ...
4358     'Parent',handles.BathymetryPanel, ...
4359     'String','Magnetic Variation', ...
4360     ...'Value',beam_angle,...
4361     'HorizontalAlignment','right',...
4362     'Units','pixels', ...
4363     'Position',[dx+5 h-ph+30-4 100 22]);
4364 handles.MagneticVariation = uicontrol('Style','edit', ...
4365     'Parent',handles.BathymetryPanel, ...
4366     ...'String','Magnetic Variation', ...
4367     'String',magnetic_variation,...
4368     'BackgroundColor','w',...
4369     'Units','pixels', ...
4370     'Position',[w-dx-80 h-ph+30 50 22]);
4371 handles.WSEText = uicontrol('Style','text', ...
4372     'Parent',handles.BathymetryPanel, ...
4373     'String','WSE (m)', ...
4374     ...'Value',beam_angle,...
4375     'HorizontalAlignment','right',...
4376     'Units','pixels', ...
4377     'Position',[dx+5 h-ph-4 100 22]);
4378 handles.WSE = uicontrol('Style','edit', ...
4379     'Parent',handles.BathymetryPanel, ...
4380     ...'String','Magnetic Variation', ...
4381     'String',num2str(wse),...
4382     'BackgroundColor','w',...
4383     'Units','pixels', ...
4384     'Position',[w-dx-80 h-ph 50 22]);
4385 handles.OutputauxiliaryData = uicontrol('Style','checkbox', ...
4386     'Parent',handles.BathymetryPanel, ...
4387     'String','Output auxiliary Data', ...
4388     'Units','pixels', ...
4389     'Position',[dx+5 20 w-2*dx-30 22]);
4390 handles.OK = uicontrol('Style',   'pushbutton', ...
4391     'Parent',  handles.Figure, ...
4392     'String',  'OK', ...
4393     'Units',   'pixels', ...
4394     'Position',[w/2-80-dx/4 6 80 22]);
4395 handles.Cancel = uicontrol('Style',   'pushbutton', ...
4396     'Parent',  handles.Figure, ...
4397     'String',  'Cancel', ...
4398     'Units',   'pixels', ...
4399     'Position',[w/2+dx/4 6 80 22]);
4400 
4401 % Update the UI controls:
4402 % -----------------------
4403 set(handles.BeamAngle,                'String',dialog_params.beam_angle)
4404 set(handles.MagneticVariation,        'String',dialog_params.magnetic_variation)
4405 set(handles.WSE,                      'String',dialog_params.wse)
4406 set(handles.OutputauxiliaryData,     'Value', double(dialog_params.output_auxiliary_data))
4407 
4408 % Set the callbacks:
4409 % ------------------
4410 set(handles.Figure,                      'CloseRequestFcn',{@dialogCloseReq,handles.OK})
4411 set(handles.BeamAngle,                   'Callback',       {@dialogExportSettings,handles})
4412 set(handles.MagneticVariation,           'Callback',       {@dialogExportSettings,handles})
4413 set(handles.WSE,                         'Callback',       {@dialogExportSettings,handles})
4414 set(handles.OutputauxiliaryData,         'Callback',       {@dialogExportSettings,handles})
4415 set(handles.OK,                          'Callback',       {@dialogOK,      handles.OK})
4416 set(handles.Cancel,                      'Callback',       {@dialogCancel,  handles})
4417 
4418 % Position the dialog and make it visible:
4419 % ----------------------------------------
4420 fpos = get(hf,'Position');
4421 dpos = [(fpos(1) + fpos(3)/2 -w/2) (fpos(2) + fpos(4)/2)];
4422 movegui(handles.Figure,dpos)
4423 set(handles.Figure,'Visible','on')
4424 
4425 % Hold the dialog open:
4426 % ---------------------
4427 waitfor(handles.OK)
4428 
4429 % Return the outputs and close the dialog:
4430 % ----------------------------------------
4431 dialog_params           = getappdata(handles.Figure,'dialog_params');
4432 beam_angle              = dialog_params.beam_angle;
4433 magnetic_variation      = dialog_params.magnetic_variation;
4434 wse                     = str2double(dialog_params.wse);
4435 output_auxiliary_data  = logical(dialog_params.output_auxiliary_data);
4436 
4437 delete(handles.Figure)
4438 
4439 % [EOF] exportSettingsDialog
4440 
4441 % --------------------------------------------------------------------
4442 function dialogExportSettings(hObject,eventdata,handles)
4443 
4444 % Grab the current data
4445 dialog_params = getappdata(handles.Figure,'dialog_params');
4446 
4447 % Set it according to the dialog box values
4448 dialog_params.beam_angle                = get(handles.BeamAngle,'String');
4449 dialog_params.magnetic_variation        = get(handles.MagneticVariation,'String');
4450 dialog_params.wse                       = get(handles.WSE,'String');
4451 dialog_params.output_auxiliary_data    = get(handles.OutputauxiliaryData,'Value');
4452 
4453 % Re-store the application data
4454 setappdata(handles.Figure,'dialog_params',dialog_params)
4455 
4456 % [EOF] dialogExportSettings
4457 
4458 function [selected_figures] = openFiguresDialog(figure_names,hf)
4459 
4460 w = 230;
4461 h = 200;
4462 dx = 10;
4463 dy = 35;
4464 the_color = get(0,'factoryUipanelBackgroundColor');
4465 handles.Figure = figure('Name', 'Select open figures to export', ...
4466     'Color',the_color, ...
4467     'NumberTitle','off', ...
4468     'HandleVisibility','callback', ...
4469     'WindowStyle','modal', ...
4470     'MenuBar','none', ...
4471     'ToolBar','none', ...
4472     'Units','pixels', ...
4473     'Position',[0 0 w h], ...
4474     'Resize','off', ...
4475     'Visible','off');
4476 dialog_params.figure_names               = figure_names;
4477 dialog_params.selected_figures           = '';
4478 setappdata(handles.Figure,'dialog_params',dialog_params)
4479 setappdata(handles.Figure,'original_dialog_params',dialog_params)
4480 
4481 % Build the graphics:
4482 % -------------------
4483 handles.ListboxPanel = uipanel('Parent',handles.Figure, ...
4484     'Title', 'Figures', ...
4485     'Units','pixels', ...
4486     'Position',[dx dy (w-2*dx) h-dx-dy+10]);
4487 handles.Figures = uicontrol('Style','listbox', ...
4488     'Parent',handles.ListboxPanel, ...
4489     'BackGroundColor','white',...
4490     'String',figure_names, ...
4491     'Min', 0,...
4492     'Max', 2,...
4493     'Units','pixels', ...
4494     'Position',[15 35 (w-5*dx) 100]);
4495 
4496 
4497 handles.OK = uicontrol('Style',   'pushbutton', ...
4498     'Parent',  handles.Figure, ...
4499     'String',  'OK', ...
4500     'Units',   'pixels', ...
4501     'Position',[w/2-80-dx/4 6 80 22]);
4502 handles.Cancel = uicontrol('Style',   'pushbutton', ...
4503     'Parent',  handles.Figure, ...
4504     'String',  'Cancel', ...
4505     'Units',   'pixels', ...
4506     'Position',[w/2+dx/4 6 80 22]);
4507 
4508 % Update the UI controls:
4509 % -----------------------
4510 
4511 
4512 % Set the callbacks:
4513 % ------------------
4514 set(handles.Figure,            'CloseRequestFcn',{@dialogCloseReq,handles.OK})
4515 set(handles.Figures,           'Callback',       {@dialogSelectFigures    handles})
4516 set(handles.OK,                'Callback',       {@dialogOK,       handles.OK})
4517 set(handles.Cancel,            'Callback',       {@dialogCancel,   handles})
4518 
4519 % Position the dialog and make it visible:
4520 % ----------------------------------------
4521 fpos = get(hf,'Position');
4522 dpos = [(fpos(1) + fpos(3)/2 -w/2) (fpos(2) + fpos(4)/2)];
4523 movegui(handles.Figure,dpos)
4524 set(handles.Figure,'Visible','on')
4525 
4526 % Hold the dialog open:
4527 % ---------------------
4528 waitfor(handles.OK)
4529 
4530 % Return the outputs and close the dialog:
4531 % ----------------------------------------
4532 dialog_params = getappdata(handles.Figure,'dialog_params');
4533 selected_figures = dialog_params.selected_figures;
4534 
4535 delete(handles.Figure)
4536 
4537 % [EOF] openFiguresDialog
4538 
4539 % --------------------------------------------------------------------
4540 function dialogSelectFigures(hObject,eventdata,handles)
4541 
4542 dialog_params = getappdata(handles.Figure,'dialog_params');
4543 
4544 idx_selected = get(handles.Figures,'Value');
4545 fig_names    = get(handles.Figures,'String');
4546 selected     = fig_names(idx_selected);
4547 dialog_params.selected_figures = selected;
4548 
4549 setappdata(handles.Figure,'dialog_params',dialog_params)
4550 
4551 
4552 
4553 % --------------------------------------------------------------------
4554 function icons = getIcons
4555 
4556 % Load data
4557 idx = 1;
4558 icons(idx).data(:,:,1) = ...
4559     [NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN
4560     NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   129   120   135   188   NaN   NaN   NaN
4561     NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN    96   189   NaN   NaN   130   NaN    95   NaN
4562     NaN   NaN   206   206   206   206   NaN   NaN   NaN   NaN   NaN   NaN   NaN    84    79   NaN
4563     NaN   206   255   255   255   255   198   197   NaN   NaN   NaN   NaN    83    79    76   NaN
4564     198   255   255   255   255   255   255   198   198   198   198   198   198   212   212   NaN
4565     198   255   255   255   255   255   255   255   255   255   255   255   198   157   197   NaN
4566     198   255   226   198   198   198   198   198   198   198   198   198   198   198   177   NaN
4567     198   255   198   218   255   255   255   255   255   255   255   255   255   255   161   NaN
4568     198   253   198   247   255   255   255   255   255   255   255   255   255   251   155   NaN
4569     198   226   201   255   255   255   255   255   255   255   255   255   231   206   165   NaN
4570     198   207   215   255   255   255   255   255   255   255   255   255   239   198   159   NaN
4571     198   198   240   255   255   255   255   255   255   255   255   255   222   157   159   NaN
4572     198   199   255   255   255   255   255   255   255   255   255   255   191   165   159   NaN
4573     NaN   165   165   165   165   165   165   165   165   165   165   165   165   159   159   NaN
4574     NaN   NaN   159   159   159   159   159   159   159   159   159   159   159   159   NaN   NaN]/255;
4575 
4576 icons(idx).data(:,:,2) = ...
4577     [NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN
4578     NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   145   137   149   195   NaN   NaN   NaN
4579     NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   116   196   NaN   NaN   145   NaN   116   NaN
4580     NaN   NaN   162   162   162   162   NaN   NaN   NaN   NaN   NaN   NaN   NaN   107   105   NaN
4581     NaN   162   255   255   255   255   154   197   NaN   NaN   NaN   NaN   106   104   103   NaN
4582     154   255   255   255   255   255   255   154   154   154   154   154   154   208   208   NaN
4583     154   243   243   243   243   243   243   255   255   255   255   255   154   123   197   NaN
4584     154   235   193   154   154   154   154   154   154   154   154   154   154   154   137   NaN
4585     154   215   154   191   255   255   251   255   255   255   255   255   231   255   126   NaN
4586     154   213   154   240   255   255   255   255   255   255   255   255   199   249   123   NaN
4587     154   179   160   255   247   247   247   247   247   247   247   247   190   188   115   NaN
4588     154   162   184   255   235   235   235   235   235   235   235   231   186   154   169   NaN
4589     154   154   228   255   227   227   227   227   227   227   227   223   178   123   169   NaN
4590     154   156   255   215   215   215   215   215   215   215   215   215   153   115   169   NaN
4591     NaN   115   115   115   115   115   115   115   115   115   115   115   115   169   169   NaN
4592     NaN   NaN   169   169   169   169   169   169   169   169   169   169   169   169   NaN   NaN]/255;
4593 
4594 icons(idx).data(:,:,3) = ...
4595     [NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN
4596     NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   166   161   170   202   NaN   NaN   NaN
4597     NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   149   205   NaN   NaN   166   NaN   148   NaN
4598     NaN   NaN    34    34    34    34   NaN   NaN   NaN   NaN   NaN   NaN   NaN   141   144   NaN
4599     NaN    34   255   255   255   255    25   197   NaN   NaN   NaN   NaN   142   145   147   NaN
4600     25   255   156   156   156   156   255    25    25    25    25    25    25   200   200   NaN
4601     25   156   140   140   140   140   140   255   255   255   255   255    25    26   197   NaN
4602     25   132    80    25    25    25    25    25    25    25    25    25    25    25    25   NaN
4603     25   132    25   108   255   255   247   255   255   255   255   255   132   255    25   NaN
4604     25   112    25   137   156   156   156   156   156   156   156   156    91   150    25   NaN
4605     25    67    33   165   148   148   148   148   148   148   148   148    83    92    13   NaN
4606     25    38    64   156   132   132   132   132   132   132   132   132    67    25   176   NaN
4607     25    26   122   156   124   124   124   124   124   124   124   124    67    26   176   NaN
4608     25    28   156   108   108   108   108   108   108   108   108   108    41    13   176   NaN
4609     NaN    13    13    13    13    13    13    13    13    13    13    13    13   176   176   NaN
4610     NaN   NaN   176   176   176   176   176   176   176   176   176   176   176   176   NaN   NaN]/255;
4611 
4612 % Save data
4613 idx = idx+1;
4614 icons(idx).data(:,:,1) = ...
4615     [NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN
4616     NaN    0.6902    0.6902    0.6902    0.6902    0.6902    0.6274    0.6274    0.5647    0.5647    0.5647    0.5019    0.5019    0.4392    0.2510       NaN
4617     NaN    0.6902    0.7529    0.5647    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    0.9412    0.3137    0.3765    0.2510    0.4670
4618     NaN    0.6902    0.7529    0.5647    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    0.9412    0.9412    0.2510    0.1882    0.2510    0.4670
4619     NaN    0.6274    0.7529    0.5019    1.0000    1.0000    1.0000    1.0000    1.0000    0.9412    0.9412    0.8784    0.1882    0.5019    0.2510    0.4670
4620     NaN    0.6274    0.7529    0.4392    1.0000    1.0000    1.0000    1.0000    0.9412    0.9412    0.8784    0.8157    0.1882    0.4392    0.2510    0.4670
4621     NaN    0.6274    0.7529    0.4392    1.0000    1.0000    1.0000    0.9412    0.9412    0.8784    0.8157    0.7529    0.1255    0.3765    0.2510    0.4670
4622     NaN    0.5647    0.7529    0.3765    1.0000    1.0000    0.9412    0.9412    0.8784    0.8157    0.7529    0.7529    0.0627    0.3765    0.2510    0.4670
4623     NaN    0.5647    0.7529    0.6902    0.3765    0.3137    0.3137    0.2510    0.1882    0.1882    0.1255    0.0627    0.3765    0.3137    0.2510    0.4670
4624     NaN    0.5019    0.6902    0.6902    0.6274    0.5647    0.5019    0.5019    0.5019    0.4392    0.4392    0.3765    0.3137    0.3137    0.2510    0.4670
4625     NaN    0.5019    0.6902    0.6274    0.5647    0.3137    0.3137    0.3137    0.3137    0.3137    0.3765    0.3137    0.3137    0.2510    0.2510    0.4670
4626     NaN    0.4392    0.6274    0.5647    0.5019    0.3137       NaN    0.1882    0.8157    0.8157    0.3765    0.2510    0.2510    0.2510    0.2510    0.4670
4627     NaN    0.4392    0.6274    0.5019    0.5019    0.3137    0.1882    0.4392    0.8784    0.8784    0.4392    0.1882    0.2510    0.1882    0.2510    0.4670
4628     NaN    0.4392    0.5647    0.5019    0.1255    0.1255    0.6902    0.6902    0.7529    0.7529    0.3137    0.1882    0.1882    0.1882    0.2510    0.4670
4629     NaN    0.7333    0.2510    0.2510    0.2510    0.2510    0.2510    0.2510    0.2510    0.2510    0.2510    0.2510    0.2510    0.2510    0.2510    0.4670
4630     NaN       NaN    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670];
4631 
4632 icons(idx).data(:,:,2) = ...
4633     [NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN
4634     NaN    0.7216    0.7216    0.6902    0.6902    0.6588    0.6274    0.5961    0.5647    0.5647    0.5333    0.5019    0.4706    0.4706    0.2196       NaN
4635     NaN    0.6902    0.7529    0.5647    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    0.9725    0.3451    0.3451    0.2196    0.5378
4636     NaN    0.6902    0.7529    0.5333    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    0.9725    0.9412    0.3137    0.1882    0.2196    0.5378
4637     NaN    0.6588    0.7529    0.5019    1.0000    1.0000    1.0000    1.0000    1.0000    0.9725    0.9412    0.9098    0.3137    0.4706    0.2196    0.5378
4638     NaN    0.6274    0.7529    0.4706    1.0000    1.0000    1.0000    1.0000    0.9725    0.9412    0.9098    0.8470    0.2824    0.4392    0.2196    0.5378
4639     NaN    0.5961    0.7529    0.4392    1.0000    1.0000    1.0000    0.9725    0.9412    0.9098    0.8470    0.8157    0.2510    0.4078    0.2196    0.5378
4640     NaN    0.5647    0.7529    0.4078    1.0000    1.0000    0.9725    0.9412    0.9098    0.8470    0.8157    0.7843    0.2196    0.3765    0.2196    0.5378
4641     NaN    0.5333    0.7216    0.7216    0.3765    0.3765    0.3451    0.3137    0.3137    0.2824    0.2510    0.2196    0.3765    0.3451    0.2196    0.5378
4642     NaN    0.5019    0.6902    0.6902    0.6274    0.5647    0.5333    0.5019    0.4706    0.4392    0.4078    0.3765    0.3451    0.3137    0.2196    0.5378
4643     NaN    0.4706    0.6588    0.6274    0.5647    0.3451    0.3451    0.3451    0.3451    0.3765    0.4078    0.3451    0.3137    0.2824    0.2196    0.5378
4644     NaN    0.4706    0.6274    0.5647    0.5333    0.3451       NaN    0.2510    0.8470    0.8784    0.4706    0.2824    0.2824    0.2510    0.2196    0.5378
4645     NaN    0.4392    0.5961    0.5333    0.5019    0.3451    0.2510    0.4706    0.8784    0.9098    0.5019    0.2510    0.2510    0.2510    0.2196    0.5378
4646     NaN    0.4078    0.5647    0.5019    0.2824    0.1882    0.7216    0.7216    0.7529    0.7843    0.3137    0.2510    0.2510    0.2196    0.2196    0.5378
4647     NaN    0.7176    0.2196    0.2196    0.2196    0.2196    0.2196    0.2196    0.2196    0.2196    0.2196    0.2196    0.2196    0.2196    0.2196    0.5378
4648     NaN       NaN    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378];
4649 
4650 icons(idx).data(:,:,3) = ...
4651     [NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN
4652     NaN    0.9412    0.9412    0.9412    0.9412    0.9412    0.9412    0.8784    0.8784    0.8784    0.8784    0.8784    0.8157    0.8157    0.4392       NaN
4653     NaN    0.9412    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    0.7529    0.6902    0.4392    0.5997
4654     NaN    0.9412    1.0000    0.9412    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    0.9412    0.7529    0.3765    0.4392    0.5997
4655     NaN    0.9412    1.0000    0.8784    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    0.9412    0.9412    0.6902    0.8784    0.4392    0.5997
4656     NaN    0.9412    1.0000    0.8784    1.0000    1.0000    1.0000    1.0000    1.0000    0.9412    0.9412    0.9412    0.6902    0.8157    0.4392    0.5997
4657     NaN    0.8784    1.0000    0.8157    1.0000    1.0000    1.0000    1.0000    0.9412    0.9412    0.9412    0.8784    0.6274    0.8157    0.4392    0.5997
4658     NaN    0.8784    1.0000    0.8157    1.0000    1.0000    1.0000    0.9412    0.9412    0.9412    0.8784    0.8784    0.6274    0.7529    0.4392    0.5997
4659     NaN    0.8784    1.0000    1.0000    0.8157    0.7529    0.7529    0.7529    0.6902    0.6902    0.6274    0.6274    0.7529    0.7529    0.4392    0.5997
4660     NaN    0.8784    1.0000    1.0000    1.0000    0.9412    0.9412    0.8784    0.8784    0.8157    0.8157    0.7529    0.7529    0.6902    0.4392    0.5997
4661     NaN    0.8157    1.0000    1.0000    0.9412    0.4392    0.4392    0.4392    0.4392    0.4392    0.5019    0.7529    0.6902    0.6902    0.4392    0.5997
4662     NaN    0.8157    1.0000    0.9412    0.9412    0.4392       NaN    0.2510    0.9412    0.9412    0.5019    0.6902    0.6902    0.6274    0.4392    0.5997
4663     NaN    0.8157    1.0000    0.9412    0.8784    0.4392    0.2510    0.5647    0.9412    0.9412    0.5647    0.6274    0.6274    0.6274    0.4392    0.5997
4664     NaN    0.8157    0.9412    0.8784    0.6902    0.2510    0.7529    0.7529    0.8157    0.8157    0.3137    0.6274    0.6274    0.6274    0.4392    0.5997
4665     NaN    0.8275    0.4392    0.4392    0.4392    0.4392    0.4392    0.4392    0.4392    0.4392    0.4392    0.4392    0.4392    0.4392    0.4392    0.5997
4666     NaN       NaN    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997];
4667 
4668 % Plotting parameters
4669 idx = idx+1;
4670 icons(idx).data(:,:,1) = ...
4671     [  0     0     0     0     0     0     0     0     0     0     0     0     0     0     0   255
4672     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4673     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   165
4674     0   255   203    79   213   255   255   255   255   255   254   160   109   247     0   165
4675     0   254    71   224    79   255   255   255   255   255   211   101   165   123     0   165
4676     0   191   123   255   123   203   255   255   255   255   101   224   254    79     0   165
4677     0   101   239   255   224   109   255   255   255   247    79   254   254   123    36   165
4678     0   123   254   255   255    79   247   255   255   165   165   255   255   224     0   165
4679     0   255   255   255   254   160   173   255   255    87   239   255   255   255     0   165
4680     0   255   255   255   255   224   101   255   239    87   255   255   255   255     0   165
4681     0   255   255   255   255   255   101   224   123   191   255   255   255   255     0   165
4682     0   255   255   255   255   254   224    54   101   255   255   255   255   255     0   165
4683     0   255   255   255   255   255   255   247   255   255   255   255   255   255     0   165
4684     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   165
4685     0     0     0     1     0     0     0     0     0     0     0     0     0     0     0   165
4686     255   165   165   165   172   165   165   165   165   165   165   165   165   165   165   165]/255;
4687 
4688 icons(idx).data(:,:,2) = ...
4689     [  0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
4690     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0     0
4691     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   165
4692     0   255   203    79   213   255   255   255   255   255   254   160   109   247     0   165
4693     0   254    71   224    79   255   255   255   255   255   211   101   165   123     0   165
4694     0   191   123   255   123   203   255   255   255   255   101   224   254    79     0   165
4695     0   101   239   255   224   109   255   255   255   247    79   254   254   123     0   165
4696     0   123   254   255   255    79   247   255   255   165   165   255   255   224     0   165
4697     0   255   255   255   254   160   173   255   255    87   239   255   255   255     0   165
4698     0   255   255   255   255   224   101   255   239    87   255   255   255   255     0   165
4699     0   255   255   255   255   255   101   224   123   191   255   255   255   255     0   165
4700     0   255   255   255   255   254   224    54   101   255   255   255   255   255     0   165
4701     0   255   255   255   255   255   255   247   255   255   255   255   255   255     0   165
4702     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   165
4703     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0   165
4704     0   165   165   165   153   165   165   165   165   165   165   165   165   165   165   165]/255;
4705 
4706 icons(idx).data(:,:,3) = ...
4707     [  0     0     0     0     0     0     0     0     0     0     0     0     0     0     0   255
4708     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4709     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4710     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4711     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4712     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4713     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4714     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4715     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4716     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4717     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4718     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4719     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4720     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4721     0    24    39     0     0     0     0     0     0     0     0     0     0     0     0   145
4722     255   145   145   145   134   145   145   145   145   145   145   145   145   145   145   145]/255;
4723 
4724 % Processing parameters
4725 idx = idx+1;
4726 icons(idx).data(:,:,1) = ...
4727     [255   255   255   255   255   255   255   255   255   255   255   255   255   255   255   255
4728     255     0     0     0   255   255   255   255   255   255   255   255     0     0     0   255
4729     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4730     255     0   255   255   107   255   255   107   255   255   255   107   255   255     0   255
4731     255     0   255   255   107   255   255   107   255   255   107   255   107   255     0   255
4732     255     0   255   255   107   255   255   107   255   255   255   107   255   255     0   255
4733     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4734     255     0   255   255   107   255   255   107   255   255   255   107   255   255     0   255
4735     255     0   255   255   107   255   107   255   107   255   255   107   255   255     0   255
4736     255     0   255   255   107   255   255   107   255   255   255   107   255   255     0   255
4737     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4738     255     0   255   255   107   255   255   107   255   255   255   107   255   255     0   255
4739     255     0   255   107   255   107   255   107   255   255   107   255   107   255     0   255
4740     255     0   255   255   107   255   255   107   255   255   255   107   255   255     0   255
4741     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4742     255     0     0     0   255   255   255   255   255   255   255   255     0     0     0   255]/255;
4743 
4744 icons(idx).data(:,:,2) = ...
4745     [255   255   255   255   255   255   255   255   255   255   255   255   255   255   255   255
4746     255     0     0     0   255   255   255   255   255   255   255   255     0     0     0   255
4747     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4748     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4749     255     0   255   255    99   255   255    99   255   255    99   255    99   255     0   255
4750     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4751     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4752     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4753     255     0   255   255    99   255    99   255    99   255   255    99   255   255     0   255
4754     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4755     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4756     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4757     255     0   255    99   255    99   255    99   255   255    99   255    99   255     0   255
4758     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4759     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4760     255     0     0     0   255   255   255   255   255   255   255   255     0     0     0   255]/255;
4761 
4762 icons(idx).data(:,:,3) = ...
4763     [255   255   255   255   255   255   255   255   255   255   255   255   255   255   255   255
4764     255     0     0     0   255   255   255   255   255   255   255   255     0     0     0   255
4765     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4766     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4767     255     0   255   255    99   255   255    99   255   255    99   255    99   255     0   255
4768     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4769     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4770     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4771     255     0   255   255    99   255    99   255    99   255   255    99   255   255     0   255
4772     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4773     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4774     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4775     255     0   255    99   255    99   255    99   255   255    99   255    99   255     0   255
4776     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4777     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4778     255     0     0     0   255   255   255   255   255   255   255   255     0     0     0   255]/255;
4779 
4780 % Export bathymetry dialog
4781 idx = idx+1;
4782 icons(idx).data(:,:,1) = ...
4783     [226    226    226    226    226    226    226    197    220    226    226    226    226    226    226    226
4784     226    226    226    226    226    227    241    144    158    241    228    228    229    228    229    226
4785     226    243    243    243    237    237    246    164    119    242    232    225    226    218    243    206
4786     179    152    153    166    148    148    177    179    63    185    141    146    154    151    179    189
4787     167    4    134    175    151    164    161    198    122    255    212    233    215    199    140    185
4788     134    50    209    241    255    255    133    118    15    20    28    94    4    0    0    89
4789     136    0    0    0    0    0    0    0    0    0    0    0    0    21    56    140
4790     208    255    226    233    255    242    215    232    251    237    226    233    207    222    156    139
4791     172    159    152    153    166    145    178    147    169    164    161    163    154    153    128    135
4792     160    164    148    139    171    150    165    154    165    185    166    173    190    190    148    162
4793     214    233    211    203    217    212    217    238    202    236    213    222    230    224    184    184
4794     219    206    174    190    219    204    201    218    183    224    219    222    217    202    176    182
4795     210    182    183    214    225    220    203    229    175    217    220    220    222    212    184    185
4796     197    175    207    224    223    220    205    231    170    221    220    220    222    217    191    187
4797     186    193    223    224    220    201    203    228    171    224    218    220    222    215    190    187
4798     189    211    220    216    204    201    214    213    187    213    216    220    220    212    193    189
4799     ]/255;
4800 icons(idx).data(:,:,2) = ...
4801     [233    233    233    233    233    233    233    204    227    233    233    233    233    233    233    233
4802     233    233    233    233    233    234    247    152    167    247    235    234    235    234    236    233
4803     233    242    242    240    236    237    247    170    131    243    234    231    234    224    245    212
4804     208    193    199    209    196    196    211    197    100    211    194    196    200    199    202    196
4805     205    19    179    199    183    197    182    179    162    255    217    246    234    231    191    199
4806     167    47    229    240    255    252    139    154    87    86    99    139    79    46    23    121
4807     175    30    47    29    28    19    5    41    33    39    54    55    65    83    81    185
4808     236    255    249    253    255    251    240    255    235    255    247    252    233    245    204    190
4809     208    200    195    196    204    192    214    202    144    215    201    201    195    195    177    186
4810     200    201    189    183    206    192    204    210    111    231    209    214    222    223    199    209
4811     245    255    251    247    254    254    252    255    156    255    254    255    255    254    235    232
4812     249    244    227    237    247    244    242    255    132    239    254    250    247    244    228    231
4813     245    231    231    246    253    249    243    255    119    223    255    251    250    245    229    232
4814     239    227    244    251    251    248    244    255    110    217    255    250    251    246    233    233
4815     233    237    250    252    249    242    246    255    115    209    255    250    251    246    232    232
4816     234    245    249    247    242    242    246    231    154    192    246    249    249    245    234    233
4817     ]/255;
4818 icons(idx).data(:,:,3) = ...
4819     [233    233    233    233    233    233    233    204    227    233    233    233    233    233    233    233
4820     233    233    233    233    233    234    247    152    167    247    235    234    235    234    236    233
4821     233    242    242    240    236    237    247    170    131    243    234    231    234    224    245    212
4822     208    193    199    209    196    196    211    197    100    211    194    196    200    199    202    196
4823     205    19    179    199    183    197    182    179    162    255    217    246    234    231    191    199
4824     167    47    229    240    255    252    139    154    87    86    99    139    79    46    23    121
4825     175    30    47    29    28    19    5    41    33    39    54    55    65    83    81    185
4826     236    255    249    253    255    251    240    255    235    255    247    252    233    245    204    190
4827     208    200    195    196    204    192    214    202    144    215    201    201    195    195    177    186
4828     200    201    189    183    206    192    204    210    111    231    209    214    222    223    199    209
4829     245    255    251    247    254    254    252    255    156    255    254    255    255    254    235    232
4830     249    244    227    237    247    244    242    255    132    239    254    250    247    244    228    231
4831     245    231    231    246    253    249    243    255    119    223    255    251    250    245    229    232
4832     239    227    244    251    251    248    244    255    110    217    255    250    251    246    233    233
4833     233    237    250    252    249    242    246    255    115    209    255    250    251    246    232    232
4834     234    245    249    247    242    242    246    231    154    192    246    249    249    245    234    233
4835     ]/255;
4836 
4837 % Export Figures Dialog
4838 idx = idx + 1;
4839 icons(idx).data(:,:,1) = ...
4840     [NaN    NaN    10    23    23    23    23    23    23    23    21    3    NaN    NaN    NaN    NaN
4841     NaN    NaN    67    255    255    255    255    255    255    255    201    141    NaN    NaN    NaN    NaN
4842     NaN    NaN    43    255    241    240    241    246    252    255    186    220    151    NaN    NaN    NaN
4843     NaN    NaN    42    255    238    237    237    236    238    254    210    178    214    38    NaN    NaN
4844     NaN    NaN    43    255    241    241    241    241    240    244    252    255    255    79    NaN    NaN
4845     NaN    NaN    47    255    232    232    225    224    224    223    220    238    255    69    NaN    NaN
4846     NaN    NaN    55    233    114    225    230    223    221    221    215    237    255    67    NaN    NaN
4847     4    NaN    37    181    168    126    193    214    205    200    203    242    255    67    NaN    NaN
4848     41    164    134    153    144    139    131    209    238    223    242    240    255    67    NaN    NaN
4849     41    118    91    91    122    125    120    106    170    241    245    241    255    67    NaN    NaN
4850     41    113    91    89    97    108    99    89    117    205    190    230    255    67    NaN    NaN
4851     41    124    94    88    78    74    81    179    255    252    244    241    255    67    NaN    NaN
4852     13    34    76    187    88    92    222    255    255    250    250    250    255    73    NaN    NaN
4853     NaN    NaN    69    236    121    227    255    243    238    238    238    238    255    82    NaN    NaN
4854     NaN    NaN    NaN    0    0    0    0    0    0    0    0    0    0    0    NaN    NaN]/255;
4855 
4856 
4857 icons(idx).data(:,:,2) = ...
4858     [NaN    NaN    10    24    24    24    24    24    24    24    22    4    NaN    NaN    NaN    NaN
4859     NaN    NaN    69    255    255    255    255    255    255    255    204    144    NaN    NaN    NaN    NaN
4860     NaN    NaN    45    255    241    240    241    246    252    255    189    222    155    NaN    NaN    NaN
4861     NaN    NaN    43    255    238    237    237    236    238    254    210    179    215    39    NaN    NaN
4862     NaN    NaN    44    255    241    241    241    241    240    244    252    255    255    80    NaN    NaN
4863     NaN    NaN    49    255    231    230    225    224    224    223    220    238    255    70    NaN    NaN
4864     NaN    NaN    56    227    136    214    227    223    221    221    215    237    255    68    NaN    NaN
4865     4    NaN    19    157    243    154    181    210    204    200    203    242    255    67    NaN    NaN
4866     51    255    231    225    219    217    172    197    232    222    242    240    255    67    NaN    NaN
4867     52    227    184    183    195    201    204    172    169    239    245    241    255    67    NaN    NaN
4868     51    218    177    177    180    187    187    177    130    202    190    230    255    67    NaN    NaN
4869     51    237    195    183    172    170    152    175    255    251    244    241    255    67    NaN    NaN
4870     15    38    72    173    183    149    211    255    255    250    250    250    255    73    NaN    NaN
4871     NaN    NaN    65    226    174    214    252    242    238    238    238    238    255    84    NaN    NaN
4872     NaN    NaN    NaN    0    0    0    0    0    0    0    0    0    0    0    NaN    NaN]/255;
4873 
4874 
4875 icons(idx).data(:,:,3) = ...
4876     [NaN    NaN    9    23    23    23    23    23    23    23    21    3    NaN    NaN    NaN    NaN
4877     NaN    NaN    66    255    255    255    255    255    255    255    196    139    NaN    NaN    NaN    NaN
4878     NaN    NaN    42    255    239    238    238    244    252    255    186    216    148    NaN    NaN    NaN
4879     NaN    NaN    41    255    236    235    235    234    237    251    210    176    212    36    NaN    NaN
4880     NaN    NaN    42    255    239    239    239    239    238    241    252    255    255    78    NaN    NaN
4881     NaN    NaN    46    255    233    232    224    223    223    223    219    235    255    67    NaN    NaN
4882     NaN    NaN    53    240    101    232    230    221    219    218    213    235    255    65    NaN    NaN
4883     5    NaN    60    212    94    107    205    215    203    198    201    240    255    66    NaN    NaN
4884     34    56    40    80    70    62    94    222    241    221    240    238    255    66    NaN    NaN
4885     35    10    2    0    51    55    36    46    176    240    243    239    255    66    NaN    NaN
4886     35    11    9    7    16    34    12    6    110    204    188    228    255    66    NaN    NaN
4887     35    14    0    0    0    0    14    187    255    251    242    239    255    66    NaN    NaN
4888     12    37    84    206    0    41    234    255    255    248    248    248    255    72    NaN    NaN
4889     NaN    NaN    69    249    79    239    255    240    236    236    236    236    255    80    NaN    NaN
4890     NaN    NaN    NaN    0    0    0    0    0    0    0    0    0    0    0    NaN    NaN]/255;
4891 
4892 % Export Excel File
4893 idx = idx + 1;
4894 icons(idx).data(:,:,1) = ...
4895     [NaN    NaN    NaN    NaN    NaN    NaN  106  252  255  255  255  255  255  255  255  255
4896    38  136  109  101   96   77   95  134  106   99   93   87   90   66  255  255
4897    52  197  232  217  210  202  191  178  170  164  160  159  155   15  255  255
4898    51  181  255  255  255  255  255  255  255  255  255  255  253    9  255  255
4899    49  174  245  153  156  175  255  255  181  153  149  205  245    0  255  255
4900    47  168  199  122  149  100  155  183   99   99   15  117  245    0  255  241
4901    45  158  255  146  146  141   87   68  120   34   86  255  238    0  252  232
4902    42  144  255  255  158  158  143   74   68  117  255  255  230    0  255  255
4903    40  134  255  255  169   15  150  111   68   81  105  167  236    0  230  217
4904    37  131  255  158   99  106   10  143  117   50   51  165  252    0  255  254
4905    35  122  208    0   22   32    8   17  110   20    0   13  212    0  255  245
4906    33  115  255  255  255  255  255  250  146  113  119  106  217    0  236  217
4907    31  109  255  254  252  251  250  255  255  255  255  255  241    0  255  251
4908    29  116  190  168  164  157  145  133  126  121  117  118  112    0  215  205
4909    20   63   47   38   36   20   38   83   64   51   52   55   64   20  255  241
4910     NaN    NaN    NaN    NaN    NaN    NaN   96  249  252  228  237  251  249  203  241  246]/255;
4911 
4912 icons(idx).data(:,:,2) = ...
4913     [NaN    NaN    NaN    NaN    NaN    NaN  114  252  255  255  255  255  255  255  255  255
4914    49  180  152  145  140  118  140  173  150  139  132  126  126  106  255  255
4915    67  249  252  242  237  231  221  207  201  196  194  193  193   75  255  255
4916    66  232  255  255  255  255  255  255  255  255  255  255  255   68  255  255
4917    64  226  251  197  191  200  255  255  194  170  168  214  253   61  255  255
4918    62  220  224  183  207  173  189  202  167  175  116  172  253   58  255  246
4919    60  211  255  190  196  203  166  131  187  134  148  255  249   54  254  240
4920    57  199  255  255  198  203  202  158  132  168  255  255  245   47  255  255
4921    54  190  255  255  200  110  199  185  155  147  160  203  251   44  240  230
4922    52  187  255  204  187  194  121  204  189  139   99  179  255   39  255  254
4923    49  180  230   42   49   53   36   64  182   98   65   70  228   36  255  248
4924    47  171  255  255  255  255  255  255  186  115  124  114  235   34  243  229
4925    45  166  255  255  254  254  255  255  255  255  255  255  255   33  255  252
4926    43  176  222  206  204  200  190  180  174  171  169  169  169   32  229  220
4927    30  101   81   74   69   54   72  116   96   84   84   84   94   55  255  245
4928     NaN    NaN    NaN    NaN    NaN    NaN  105  251  253  237  242  252  251  218  246  249]/255;
4929 
4930 icons(idx).data(:,:,3) = ...
4931     [ NaN    NaN    NaN    NaN    NaN    NaN  125  253  255  255  255  255  255  255  255  255
4932    34  118   92   84   79   56   83  111   88   79   73   69   74   45  255  255
4933    46  180  228  207  203  195  182  169  159  155  149  149  145    0  255  255
4934    45  163  255  255  255  255  255  255  255  255  255  255  254    0  255  255
4935    42  156  248  152  155  176  255  255  181  154  147  206  245    0  255  255
4936    40  150  202  117  136   87  154  181   90   84    8  120  243    0  255  252
4937    38  138  255  145  137  131   81   65  106   27   86  255  238    0  255  250
4938    35  122  255  255  159  152  137   75   62  121  255  255  229    0  255  255
4939    33  113  255  255  171   13  145  111   67   76   84  159  234    0  255  247
4940    30  109  255  160   89   97   10  136  111   36   33  159  251    0  255  255
4941    28   99  211    0   12   23    2   11  101    0    0   13  209    0  255  253
4942    26   92  255  255  255  255  255  250  146  111  117  104  213    0  255  245
4943    23   89  255  255  255  255  255  255  255  255  255  255  241    0  255  254
4944    22   93  180  156  151  141  129  114  105   98   93   93   83    0  255  239
4945    15   43   26   17   15    0   25   63   45   39   38   39   44    9  255  252
4946     NaN    NaN    NaN    NaN    NaN    NaN  117  253  255  249  251  255  254  239  252  254]/255;
4947 
4948 % Zoom In
4949 idx = idx + 1;
4950 icons(idx).data(:,:,1) = ...
4951     [NaN,NaN,0.745082780193790,0.603906309605554,0.603906309605554,0.603906309605554,0.603906309605554,0.568627450980392,0.764705882352941,NaN,NaN,NaN,NaN,NaN,NaN,NaN;NaN,0.698023956664378,0.568627450980392,0.780392156862745,0.823514152742809,0.854886701762417,0.925474937056535,0.827450980392157,0.596063172350652,0.749019607843137,NaN,NaN,NaN,NaN,NaN,NaN;0.752925917448692,0.501945525291829,0.737239642938888,0.643121995880064,0.584313725490196,0.690180819409476,0.760769054703594,1,0.894102388036927,0.596063172350652,NaN,NaN,NaN,NaN,NaN,NaN;0.682337682154574,0.639215686274510,0.650965133134966,0.600000000000000,0.596063172350652,0.196078431372549,0.596063172350652,0.764705882352941,0.941161211566339,0.721553368429084,0.603906309605554,NaN,NaN,NaN,NaN,NaN;0.603906309605554,0.686274509803922,0.678431372549020,0.682337682154574,0.662745098039216,0.196078431372549,0.650965133134966,0.639215686274510,0.788235294117647,0.811764705882353,0.603906309605554,NaN,NaN,NaN,NaN,NaN;0.603906309605554,0.764705882352941,0.815671015487907,0.196078431372549,0.196078431372549,0.196078431372549,0.196078431372549,0.196078431372549,0.682337682154574,0.815671015487907,0.603906309605554,NaN,NaN,NaN,NaN,NaN;0.603906309605554,0.866666666666667,0.952941176470588,0.803921568627451,0.803921568627451,0.196078431372549,0.619592584115358,0.607843137254902,0.737239642938888,0.741176470588235,0.603906309605554,NaN,NaN,NaN,NaN,NaN;0.682337682154574,0.721553368429084,1,1,0.968627450980392,0.196078431372549,0.709803921568628,0.670588235294118,0.807827878233005,0.564690623331045,0.772549019607843,NaN,NaN,NaN,NaN,NaN;NaN,0.592156862745098,0.839200427252613,1,1,0.901945525291829,0.788235294117647,0.792141603723201,0.549004348821241,0.654901960784314,NaN,1,NaN,NaN,NaN,NaN;NaN,NaN,0.639215686274510,0.698023956664378,0.827450980392157,0.784298466468299,0.650965133134966,0.498054474708171,0.623529411764706,0.627435721370260,0.890196078431373,0.937254901960784,0.996063172350652,NaN,NaN,NaN;NaN,NaN,NaN,0.772549019607843,0.698023956664378,0.678431372549020,0.690180819409476,0.784298466468299,0.666651407644770,0.615686274509804,0.745082780193790,1,0.933318074311437,0.996063172350652,NaN,NaN;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.705867093919280,0.517631799801633,0.745082780193790,1,0.929411764705882,1,NaN;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.701960784313725,0.513725490196078,0.741176470588235,1,0.925474937056535,0.749019607843137;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.705867093919280,0.513725490196078,0.741176470588235,0.988220035095750,0.745082780193790;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.701960784313725,0.533318074311437,0.549004348821241,0.654901960784314;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.694117647058824,0.635278858625162,NaN;];
4952 icons(idx).data(:,:,2) = ...
4953     [1,1,0.745082780193790,0.670588235294118,0.670588235294118,0.670588235294118,0.670588235294118,0.576470588235294,0.760769054703594,1,1,1,1,1,1,1;1,0.701960784313725,0.650965133134966,0.917631799801633,0.968627450980392,0.992156862745098,1,0.898039215686275,0.603906309605554,0.741176470588235,1,1,1,1,1,1;0.756862745098039,0.588220035095750,0.929411764705882,0.858823529411765,0.807827878233005,0.854886701762417,0.894102388036927,1,0.976470588235294,0.596063172350652,1,1,1,1,1,1;0.721553368429084,0.823514152742809,0.878416113527123,0.835294117647059,0.831357289997711,0.274509803921569,0.815671015487907,0.894102388036927,1,0.807827878233005,0.670588235294118,1,1,1,1,1;0.670588235294118,0.901945525291829,0.890196078431373,0.890196078431373,0.878416113527123,0.274509803921569,0.854886701762417,0.831357289997711,0.937254901960784,0.933318074311437,0.670588235294118,1,1,1,1,1;0.670588235294118,0.937254901960784,0.937254901960784,0.274509803921569,0.274509803921569,0.274509803921569,0.274509803921569,0.274509803921569,0.878416113527123,0.937254901960784,0.670588235294118,1,1,1,1,1;0.670588235294118,0.937254901960784,0.988220035095750,0.862729839017319,0.862729839017319,0.274509803921569,0.815671015487907,0.803921568627451,0.921568627450980,0.854886701762417,0.670588235294118,1,1,1,1,1;0.721553368429084,0.737239642938888,1,1,0.988220035095750,0.274509803921569,0.898039215686275,0.882352941176471,0.980376897840848,0.627435721370260,0.768612191958496,1,1,1,1,1;1,0.603906309605554,0.847043564507515,1,1,0.984313725490196,0.960784313725490,0.976470588235294,0.662745098039216,0.658808270389868,1,0.615686274509804,1,1,1,1;1,1,0.650965133134966,0.701960784313725,0.854886701762417,0.874509803921569,0.780392156862745,0.564690623331045,0.615686274509804,0.627435721370260,0.733333333333333,0.713710231174182,0.600000000000000,1,1,1;1,1,1,0.772549019607843,0.705867093919280,0.686274509803922,0.694117647058824,0.784298466468299,0.674494544899672,0.572533760585946,0.498054474708171,0.741176470588235,0.709803921568628,0.600000000000000,1,1;1,1,1,1,1,1,1,1,1,0.701960784313725,0.439215686274510,0.509788662546731,0.741176470588235,0.709803921568628,0.600000000000000,1;1,1,1,1,1,1,1,1,1,1,0.701960784313725,0.439215686274510,0.505882352941176,0.741176470588235,0.721553368429084,0.501945525291829;1,1,1,1,1,1,1,1,1,1,1,0.705867093919280,0.443152513923857,0.505882352941176,0.733333333333333,0.670588235294118;1,1,1,1,1,1,1,1,1,1,1,1,0.705867093919280,0.454901960784314,0.435309376668956,0.658808270389868;1,1,1,1,1,1,1,1,1,1,1,1,1,0.694117647058824,0.647058823529412,1;];
4954 icons(idx).data(:,:,3) = ...
4955     [1,1,0.796078431372549,0.854886701762417,0.854886701762417,0.854886701762417,0.854886701762417,0.713710231174182,0.792141603723201,1,1,1,1,1,1,1;1,0.768612191958496,0.827450980392157,0.956847486076143,0.976470588235294,0.992156862745098,1,0.945098039215686,0.803921568627451,0.796078431372549,1,1,1,1,1,1;0.776455329213397,0.749019607843137,0.952941176470588,0.901945525291829,0.882352941176471,0.909788662546731,0.937254901960784,1,0.988220035095750,0.819607843137255,1,1,1,1,1,1;0.858823529411765,0.882352941176471,0.909788662546731,0.882352941176471,0.886259250782025,0.470588235294118,0.882352941176471,0.933318074311437,1,0.921568627450980,0.854886701762417,1,1,1,1,1;0.854886701762417,0.925474937056535,0.909788662546731,0.913725490196078,0.905882352941177,0.470588235294118,0.901945525291829,0.894102388036927,0.960784313725490,0.968627450980392,0.854886701762417,1,1,1,1,1;0.854886701762417,0.945098039215686,0.949004348821241,0.470588235294118,0.470588235294118,0.470588235294118,0.470588235294118,0.470588235294118,0.921568627450980,0.968627450980392,0.854886701762417,1,1,1,1,1;0.854886701762417,0.952941176470588,0.992156862745098,0.917631799801633,0.917631799801633,0.470588235294118,0.945098039215686,0.949004348821241,0.941161211566339,0.937254901960784,0.854886701762417,1,1,1,1,1;0.858823529411765,0.827450980392157,1,1,0.992156862745098,0.470588235294118,0.921568627450980,0.909788662546731,0.980376897840848,0.823514152742809,0.792141603723201,1,1,1,1,1;1,0.717647058823529,0.925474937056535,1,1,0.980376897840848,0.960784313725490,0.976470588235294,0.815671015487907,0.776455329213397,1,0.180392156862745,1,1,1,1;1,1,0.776455329213397,0.870572976272221,0.941161211566339,0.937254901960784,0.866666666666667,0.717647058823529,0.682337682154574,0.607843137254902,0.490211337453269,0.435309376668956,0.203921568627451,1,1,1;1,1,1,0.799984740978103,0.796078431372549,0.792141603723201,0.764705882352941,0.792141603723201,0.780392156862745,0.545098039215686,0.125490196078431,0.325505455100328,0.450995651178759,0.203921568627451,1,1;1,1,1,1,1,1,1,1,1,0.784298466468299,0.384313725490196,0.149019607843137,0.325505455100328,0.458838788433661,0.180392156862745,1;1,1,1,1,1,1,1,1,1,1,0.796078431372549,0.396093690394446,0.149019607843137,0.329411764705882,0.458838788433661,0.254917219806210;1,1,1,1,1,1,1,1,1,1,1,0.803921568627451,0.407843137254902,0.149019607843137,0.298039215686275,0.580376897840848;1,1,1,1,1,1,1,1,1,1,1,1,0.803921568627451,0.403936827649348,0.258823529411765,0.674494544899672;1,1,1,1,1,1,1,1,1,1,1,1,1,0.749019607843137,0.654901960784314,1;];
4956 
4957 % Zoom Out
4958 idx = idx + 1;
4959 icons(idx).data(:,:,1) = ...
4960     [NaN,NaN,0.745082780193790,0.603906309605554,0.603906309605554,0.603906309605554,0.603906309605554,0.568627450980392,0.764705882352941,NaN,NaN,NaN,NaN,NaN,NaN,NaN;NaN,0.698023956664378,0.568627450980392,0.780392156862745,0.823514152742809,0.854886701762417,0.925474937056535,0.827450980392157,0.596063172350652,0.749019607843137,NaN,NaN,NaN,NaN,NaN,NaN;0.752925917448692,0.501945525291829,0.737239642938888,0.643121995880064,0.584313725490196,0.690180819409476,0.760769054703594,1,0.894102388036927,0.596063172350652,NaN,NaN,NaN,NaN,NaN,NaN;0.682337682154574,0.639215686274510,0.650965133134966,0.600000000000000,0.596063172350652,0.643121995880064,0.596063172350652,0.764705882352941,0.941161211566339,0.721553368429084,0.603906309605554,NaN,NaN,NaN,NaN,NaN;0.603906309605554,0.686274509803922,0.678431372549020,0.682337682154574,0.662745098039216,0.650965133134966,0.650965133134966,0.639215686274510,0.788235294117647,0.811764705882353,0.603906309605554,NaN,NaN,NaN,NaN,NaN;0.603906309605554,0.764705882352941,0.815671015487907,0.196078431372549,0.196078431372549,0.196078431372549,0.196078431372549,0.196078431372549,0.682337682154574,0.815671015487907,0.603906309605554,NaN,NaN,NaN,NaN,NaN;0.603906309605554,0.866666666666667,0.952941176470588,0.760769054703594,0.760769054703594,0.760769054703594,0.760769054703594,0.760769054703594,0.737239642938888,0.741176470588235,0.603906309605554,NaN,NaN,NaN,NaN,NaN;0.682337682154574,0.721553368429084,1,1,0.968627450980392,0.870572976272221,0.709803921568628,0.670588235294118,0.807827878233005,0.564690623331045,0.772549019607843,NaN,NaN,NaN,NaN,NaN;NaN,0.592156862745098,0.839200427252613,1,1,0.901945525291829,0.788235294117647,0.792141603723201,0.549004348821241,0.654901960784314,NaN,NaN,NaN,NaN,NaN,NaN;NaN,NaN,0.639215686274510,0.698023956664378,0.827450980392157,0.784298466468299,0.650965133134966,0.498054474708171,0.623529411764706,0.627435721370260,0.890196078431373,0.937254901960784,0.996063172350652,NaN,NaN,NaN;NaN,NaN,NaN,0.772549019607843,0.698023956664378,0.678431372549020,0.690180819409476,0.784298466468299,NaN,0.615686274509804,0.745082780193790,1,0.933318074311437,0.996063172350652,NaN,NaN;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.705867093919280,0.517631799801633,0.745082780193790,1,0.929411764705882,1,NaN;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.701960784313725,0.513725490196078,0.741176470588235,1,0.925474937056535,0.749019607843137;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.705867093919280,0.513725490196078,0.741176470588235,0.988220035095750,0.745082780193790;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.701960784313725,0.533318074311437,0.549004348821241,0.654901960784314;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.694117647058824,0.635278858625162,NaN;];
4961 icons(idx).data(:,:,2) = ...
4962     [1,1,0.745082780193790,0.670588235294118,0.670588235294118,0.670588235294118,0.670588235294118,0.576470588235294,0.760769054703594,1,1,1,1,1,1,1;1,0.701960784313725,0.650965133134966,0.917631799801633,0.968627450980392,0.992156862745098,1,0.898039215686275,0.603906309605554,0.741176470588235,1,1,1,1,1,1;0.756862745098039,0.588220035095750,0.929411764705882,0.858823529411765,0.807827878233005,0.854886701762417,0.894102388036927,1,0.976470588235294,0.596063172350652,1,1,1,1,1,1;0.721553368429084,0.823514152742809,0.878416113527123,0.835294117647059,0.831357289997711,0.843137254901961,0.815671015487907,0.894102388036927,1,0.807827878233005,0.670588235294118,1,1,1,1,1;0.670588235294118,0.901945525291829,0.890196078431373,0.890196078431373,0.878416113527123,0.870572976272221,0.854886701762417,0.831357289997711,0.937254901960784,0.933318074311437,0.670588235294118,1,1,1,1,1;0.670588235294118,0.937254901960784,0.937254901960784,0.274509803921569,0.274509803921569,0.274509803921569,0.274509803921569,0.274509803921569,0.878416113527123,0.937254901960784,0.670588235294118,1,1,1,1,1;0.670588235294118,0.937254901960784,0.988220035095750,0.819607843137255,0.819607843137255,0.819607843137255,0.819607843137255,0.819607843137255,0.921568627450980,0.854886701762417,0.670588235294118,1,1,1,1,1;0.721553368429084,0.737239642938888,1,1,0.988220035095750,0.952941176470588,0.898039215686275,0.882352941176471,0.980376897840848,0.627435721370260,0.768612191958496,1,1,1,1,1;1,0.603906309605554,0.847043564507515,1,1,0.984313725490196,0.960784313725490,0.976470588235294,0.662745098039216,0.658808270389868,1,1,1,1,1,1;1,1,0.650965133134966,0.701960784313725,0.854886701762417,0.874509803921569,0.780392156862745,0.564690623331045,0.615686274509804,0.627435721370260,0.733333333333333,0.713710231174182,0.600000000000000,1,1,1;1,1,1,0.772549019607843,0.705867093919280,0.686274509803922,0.694117647058824,0.784298466468299,1,0.572533760585946,0.498054474708171,0.741176470588235,0.709803921568628,0.600000000000000,1,1;1,1,1,1,1,1,1,1,1,0.701960784313725,0.439215686274510,0.509788662546731,0.741176470588235,0.709803921568628,0.600000000000000,1;1,1,1,1,1,1,1,1,1,1,0.701960784313725,0.439215686274510,0.505882352941176,0.741176470588235,0.721553368429084,0.501945525291829;1,1,1,1,1,1,1,1,1,1,1,0.705867093919280,0.443152513923857,0.505882352941176,0.733333333333333,0.670588235294118;1,1,1,1,1,1,1,1,1,1,1,1,0.705867093919280,0.454901960784314,0.435309376668956,0.658808270389868;1,1,1,1,1,1,1,1,1,1,1,1,1,0.694117647058824,0.647058823529412,1;];
4963 icons(idx).data(:,:,3) = ...
4964     [1,1,0.796078431372549,0.854886701762417,0.854886701762417,0.854886701762417,0.854886701762417,0.713710231174182,0.792141603723201,1,1,1,1,1,1,1;1,0.768612191958496,0.827450980392157,0.956847486076143,0.976470588235294,0.992156862745098,1,0.945098039215686,0.803921568627451,0.796078431372549,1,1,1,1,1,1;0.776455329213397,0.749019607843137,0.952941176470588,0.901945525291829,0.882352941176471,0.909788662546731,0.937254901960784,1,0.988220035095750,0.819607843137255,1,1,1,1,1,1;0.858823529411765,0.882352941176471,0.909788662546731,0.882352941176471,0.886259250782025,0.894102388036927,0.882352941176471,0.933318074311437,1,0.921568627450980,0.854886701762417,1,1,1,1,1;0.854886701762417,0.925474937056535,0.909788662546731,0.913725490196078,0.905882352941177,0.901945525291829,0.901945525291829,0.894102388036927,0.960784313725490,0.968627450980392,0.854886701762417,1,1,1,1,1;0.854886701762417,0.945098039215686,0.949004348821241,0.470588235294118,0.470588235294118,0.470588235294118,0.470588235294118,0.470588235294118,0.921568627450980,0.968627450980392,0.854886701762417,1,1,1,1,1;0.854886701762417,0.952941176470588,0.992156862745098,0.890196078431373,0.890196078431373,0.890196078431373,0.890196078431373,0.890196078431373,0.941161211566339,0.937254901960784,0.854886701762417,1,1,1,1,1;0.858823529411765,0.827450980392157,1,1,0.992156862745098,0.964690623331045,0.921568627450980,0.909788662546731,0.980376897840848,0.823514152742809,0.792141603723201,1,1,1,1,1;1,0.717647058823529,0.925474937056535,1,1,0.980376897840848,0.960784313725490,0.976470588235294,0.815671015487907,0.776455329213397,1,1,1,1,1,1;1,1,0.776455329213397,0.870572976272221,0.941161211566339,0.937254901960784,0.866666666666667,0.717647058823529,0.682337682154574,0.607843137254902,0.490211337453269,0.435309376668956,0.203921568627451,1,1,1;1,1,1,0.799984740978103,0.796078431372549,0.792141603723201,0.764705882352941,0.792141603723201,1,0.545098039215686,0.125490196078431,0.325505455100328,0.450995651178759,0.203921568627451,1,1;1,1,1,1,1,1,1,1,1,0.784298466468299,0.384313725490196,0.149019607843137,0.325505455100328,0.458838788433661,0.180392156862745,1;1,1,1,1,1,1,1,1,1,1,0.796078431372549,0.396093690394446,0.149019607843137,0.329411764705882,0.458838788433661,0.254917219806210;1,1,1,1,1,1,1,1,1,1,1,0.803921568627451,0.407843137254902,0.149019607843137,0.298039215686275,0.580376897840848;1,1,1,1,1,1,1,1,1,1,1,1,0.803921568627451,0.403936827649348,0.258823529411765,0.674494544899672;1,1,1,1,1,1,1,1,1,1,1,1,1,0.749019607843137,0.654901960784314,1;];
4965 
4966 % Pan
4967 idx = idx + 1;
4968 icons(idx).data(:,:,1) = ...
4969     [NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.290196078431373,0.290196078431373,NaN,NaN,NaN,NaN,NaN,NaN,NaN;NaN,NaN,NaN,0.290196078431373,0.290196078431373,NaN,0.290196078431373,1,1,0.290196078431373,0.290196078431373,0.290196078431373,NaN,NaN,NaN,NaN;NaN,NaN,0.290196078431373,1,1,0.290196078431373,0.290196078431373,1,1,0.290196078431373,1,1,0.290196078431373,NaN,NaN,NaN;NaN,NaN,0.290196078431373,1,1,0.290196078431373,0.290196078431373,1,1,0.290196078431373,1,1,0.290196078431373,NaN,0.290196078431373,NaN;NaN,NaN,NaN,0.290196078431373,1,1,0.290196078431373,1,1,0.290196078431373,1,1,0.290196078431373,0.290196078431373,1,0.290196078431373;NaN,NaN,NaN,0.290196078431373,1,1,0.290196078431373,1,1,0.290196078431373,1,1,0.290196078431373,1,1,0.290196078431373;NaN,0.290196078431373,0.290196078431373,0.290196078431373,0.290196078431373,1,1,1,1,1,1,1,0.290196078431373,1,0.991546501869230,0.290196078431373;0.290196078431373,1,1,0.290196078431373,0.290196078431373,1,1,1,1,1,1,1,0.996032654306859,0.986602578774701,0.975188830395972,0.290196078431373;0.290196078431373,1,1,1,0.290196078431373,1,1,1,1,1,1,0.991546501869230,0.981109330891890,0.968841077286946,0.290196078431373,NaN;NaN,0.290196078431373,1,1,1,1,1,1,1,0.996032654306859,0.986602578774701,0.975188830395972,0.962127107652400,0.947631036850538,0.290196078431373,NaN;NaN,NaN,0.290196078431373,1,1,1,1,1,0.991546501869230,0.981109330891890,0.968871595330739,0.955046921492332,0.939909971770810,0.923643854428931,0.290196078431373,NaN;NaN,NaN,0.290196078431373,1,1,1,0.996063172350652,0.986572060730907,0.975188830395972,0.962127107652400,0.947631036850538,0.931914244296941,0.915190356298161,0.290196078431373,NaN,NaN;NaN,NaN,NaN,0.290196078431373,1,0.991546501869230,0.981109330891890,0.968841077286946,0.955016403448539,0.939909971770810,0.923643854428931,0.906553749904631,0.888761730373083,0.290196078431373,NaN,NaN;NaN,NaN,NaN,NaN,0.290196078431373,0.975188830395972,0.962127107652400,0.947631036850538,0.931914244296941,0.915220874341955,0.897734035248341,0.879728389410239,0.290196078431373,NaN,NaN,NaN;NaN,NaN,NaN,NaN,NaN,0.290196078431373,0.939909971770810,0.923643854428931,0.906553749904631,0.888761730373083,0.870634012359808,0.852231631952392,0.290196078431373,NaN,NaN,NaN;NaN,NaN,NaN,NaN,NaN,0.290196078431373,0.915190356298161,0.897734035248341,0.879758907454032,0.861478599221790,0.843076218814374,0.824887464713512,0.290196078431373,NaN,NaN,NaN;];
4970 icons(idx).data(:,:,2) = ...
4971     [0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.407843137254902,0.894102388036927,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.894071869993134,0.894102388036927,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.894102388036927,0.894071869993134,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.407843137254902,0.894102388036927,0.882536049439231,0.407843137254902;0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.888700694285496,0.875730525673304,0.860105287251087,0.407843137254902;0.407843137254902,0.894102388036927,0.894102388036927,0.894102388036927,0.407843137254902,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.882566567483024,0.868223086900130,0.851468680857557,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.888700694285496,0.875730525673304,0.860105287251087,0.842221713588159,0.822354467078660,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.882566567483024,0.868223086900130,0.851468680857557,0.832516975661860,0.811795223926146,0.789547570000763,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.894102388036927,0.888700694285496,0.875730525673304,0.860135805294881,0.842221713588159,0.822354467078660,0.800839246204318,0.777950713359274,0.407843137254902,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.882536049439231,0.868223086900130,0.851438162813764,0.832516975661860,0.811764705882353,0.789547570000763,0.766079194323644,0.741756313420310,0.407843137254902,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.860135805294881,0.842252231631952,0.822384985122454,0.800808728160525,0.777920195315480,0.754024567025254,0.729396505683986,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.811764705882353,0.789547570000763,0.766079194323644,0.741786831464103,0.716914625772488,0.691676203555352,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.777920195315480,0.754024567025254,0.729396505683986,0.704371709773404,0.679133287556268,0.654261081864653,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902;];
4972 icons(idx).data(:,:,3) = ...
4973     [0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.799954222934310,0.799984740978103,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.709803921568628,0.799954222934310,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.799954222934310,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.709803921568628,0.799984740978103,0.785091935606928,0.709803921568628;0.709803921568628,0.799954222934310,0.799984740978103,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.792996108949416,0.776272220950637,0.756130312046998,0.709803921568628;0.709803921568628,0.799984740978103,0.799954222934310,0.799984740978103,0.709803921568628,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.785091935606928,0.766628519111925,0.744960708018616,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.799984740978103,0.799954222934310,0.799984740978103,0.799984740978103,0.799984740978103,0.792996108949416,0.776272220950637,0.756160830090791,0.733089188982986,0.707423514152743,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.785091935606928,0.766598001068132,0.744960708018616,0.720546272983902,0.693781948577096,0.665094987411307,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.799984740978103,0.792996108949416,0.776241702906844,0.756160830090791,0.733089188982986,0.707423514152743,0.679682612344549,0.650141145952545,0.709803921568628,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.785061417563134,0.766598001068132,0.744960708018616,0.720546272983902,0.693812466620890,0.665094987411307,0.634882124055848,0.603479056992447,0.709803921568628,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.756160830090791,0.733089188982986,0.707423514152743,0.679652094300755,0.650141145952545,0.619287403677424,0.587518120088502,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.693781948577096,0.665094987411307,0.634882124055848,0.603509575036240,0.571404592965591,0.538872358281834,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.650141145952545,0.619256885633631,0.587518120088502,0.555230029755093,0.522697795071336,0.490638590066377,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628;];
4974 % [EOF] getIcons
4975 
4976 function guiparams = createGUIparams
4977 % Creates the guiparams structure with specified defaults.
4978 
4979 % Check for any stored prefs
4980 % --------------------------
4981 % Currently, units and the graphics renderer are stored as persistent prefs
4982 guiprefs = getpref('VMT');
4983 
4984 % Organized by GUI panels
4985 %%%%%%%%%%%%%%%%%%%
4986 % SHIPTRACKS PLOT %
4987 %%%%%%%%%%%%%%%%%%%
4988 guiparams.horizontal_grid_node_spacing       = 1.0;
4989 guiparams.vertical_grid_node_spacing         = 0.4;
4990 
4991 %%%%%%%%%%%%%%%%%%%%%%
4992 % CROSS SECTION PLOT %
4993 %%%%%%%%%%%%%%%%%%%%%%
4994 guiparams.contours                           = ''; % Set below
4995 guiparams.contour                            = ''; % Set below
4996 guiparams.idx_contour                        = 1;
4997 guiparams.vertical_exaggeration              = 10;
4998 guiparams.vector_scale_cross_section         = 0.2;
4999 guiparams.horizontal_vector_spacing          = 1;
5000 guiparams.vertical_vector_spacing            = 1;
5001 guiparams.horizontal_smoothing_window        = 1;
5002 guiparams.vertical_smoothing_window          = 1;
5003 guiparams.plot_secondary_flow_vectors        = true;
5004 guiparams.secondary_flows                    = ''; % Set below
5005 guiparams.secondary_flow_vector_variable     = ''; % Set below
5006 guiparams.idx_secondary_flow_vector_variable = 1;
5007 guiparams.include_vertical_velocity          = true;
5008 
5009 %%%%%%%%%%%%%%%%%%
5010 % PLAN VIEW PLOT %
5011 %%%%%%%%%%%%%%%%%%
5012 guiparams.depth_range_min                    = 0;
5013 guiparams.depth_range_max                    = inf;
5014 guiparams.vector_scale_plan_view             = 1;
5015 guiparams.vector_spacing_plan_view           = 1;
5016 guiparams.smoothing_window_size              = 1;
5017 guiparams.display_shoreline                  = false;
5018 guiparams.add_background                     = false;
5019 
5020 %%%%%%%%%%%%%%%
5021 % DATA EXPORT %
5022 %%%%%%%%%%%%%%%
5023 guiparams.beam_angle                         = 20.0;
5024 guiparams.magnetic_variation                 = 0.0;
5025 guiparams.wse                                = 0.0;
5026 guiparams.output_auxiliary_data              = false;
5027 
5028 %%%%%%%%%%%%%%%%%%%%%
5029 % Contour variables %
5030 %%%%%%%%%%%%%%%%%%%%%
5031 idx = 1;
5032 guiparams.contours(idx).string   = 'Streamwise Velocity (u)';
5033 guiparams.contours(idx).variable = 'streamwise';
5034 idx = idx + 1;
5035 guiparams.contours(idx).string   = 'Transverse Velocity (v)';
5036 guiparams.contours(idx).variable = 'transverse';
5037 idx = idx + 1;
5038 guiparams.contours(idx).string   = 'Vertical Velocity (w)';
5039 guiparams.contours(idx).variable = 'vertical';
5040 idx = idx + 1;
5041 guiparams.contours(idx).string   = 'Velocity Magnitude';
5042 guiparams.contours(idx).variable = 'mag';
5043 idx = idx + 1;
5044 guiparams.contours(idx).string   = 'East Velocity (E)';
5045 guiparams.contours(idx).variable = 'east';
5046 idx = idx + 1;
5047 guiparams.contours(idx).string   = 'North Velocity (N)';
5048 guiparams.contours(idx).variable = 'north';
5049 idx = idx + 1;
5050 guiparams.contours(idx).string   = 'Error Velocity';
5051 guiparams.contours(idx).variable = 'error';
5052 idx = idx + 1;
5053 guiparams.contours(idx).string   = 'Primary Velocity (zsd)';
5054 guiparams.contours(idx).variable = 'primary_zsd';
5055 idx = idx + 1;
5056 guiparams.contours(idx).string   = 'Secondary Velocity (zsd)';
5057 guiparams.contours(idx).variable = 'secondary_zsd';
5058 idx = idx + 1;
5059 guiparams.contours(idx).string   = 'Primary Velocity (Roz)';
5060 guiparams.contours(idx).variable = 'primary_roz';
5061 idx = idx + 1;
5062 guiparams.contours(idx).string   = 'Secondary Velocity (Roz)';
5063 guiparams.contours(idx).variable = 'secondary_roz';
5064 idx = idx + 1;
5065 guiparams.contours(idx).string   = 'Prim. Vel. (Roz, Downstream Comp.)';
5066 guiparams.contours(idx).variable = 'primary_roz_x';
5067 idx = idx + 1;
5068 guiparams.contours(idx).string   = 'Prim. Vel. (Roz, Cross-Stream Comp.)';
5069 guiparams.contours(idx).variable = 'primary_roz_y';
5070 idx = idx + 1;
5071 guiparams.contours(idx).string   = 'Sec. Vel. (Roz, Downstream Comp.)';
5072 guiparams.contours(idx).variable = 'secondary_roz_x';
5073 idx = idx + 1;
5074 guiparams.contours(idx).string   = 'Sec. Vel. (Roz, Cross-Stream Comp.)';
5075 guiparams.contours(idx).variable = 'secondary_roz_y';
5076 idx = idx + 1;
5077 guiparams.contours(idx).string   = 'Backscatter';
5078 guiparams.contours(idx).variable = 'backscatter';
5079 idx = idx + 1;
5080 guiparams.contours(idx).string   = 'Flow Direction (deg.)';
5081 guiparams.contours(idx).variable = 'flowangle';
5082 
5083 guiparams.contour = guiparams.contours(guiparams.idx_contour).variable;
5084 
5085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5086 % Secondary Flow Vector Variables %
5087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5088 idx = 1;
5089 guiparams.secondary_flows(idx).string   = 'Transverse';
5090 guiparams.secondary_flows(idx).variable = 'transverse';
5091 idx = idx + 1;
5092 guiparams.secondary_flows(idx).string   = 'Secondary (zsd)';
5093 guiparams.secondary_flows(idx).variable = 'secondary_zsd';
5094 idx = idx + 1;
5095 guiparams.secondary_flows(idx).string   = 'Secondary (Roz)';
5096 guiparams.secondary_flows(idx).variable = 'secondary_roz';
5097 idx = idx + 1;
5098 guiparams.secondary_flows(idx).string   = 'Secondary (Roz, Cross-Stream Comp)';
5099 guiparams.secondary_flows(idx).variable = 'secondary_roz_y';
5100 idx = idx + 1;
5101 guiparams.secondary_flows(idx).string   = 'Primary (Roz, Cross-Stream Comp)';
5102 guiparams.secondary_flows(idx).variable  = 'primary_roz_y';
5103 
5104 guiparams.secondary_flow_vector_variable = ...
5105     guiparams.secondary_flows(guiparams.idx_secondary_flow_vector_variable).variable;
5106 
5107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5108 % INTERNAL SETTINGS & DEFAULTS %
5109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5110 % Menu bar options
5111 guiparams.presentation                       = true;
5112 guiparams.print                              = false;
5113 guiparams.set_cross_section_endpoints        = false;
5114 guiparams.unit_discharge_correction          = false;
5115 
5116 if ispref('VMT','units')
5117     switch guiprefs.units
5118         case 'metric'
5119             guiparams.english_units          = false;
5120         case 'english'
5121             guiparams.english_units          = true;
5122     end
5123 else
5124     guiparams.english_units                  = false;
5125 end
5126 guiparams.vertical_offset                    = 0;
5127 
5128 if ispref('VMT','renderer')
5129     guiparams.renderer                       = guiprefs.renderer;
5130 else
5131     guiparams.renderer                       = 'OpenGL';
5132 end
5133 % guiparams.plot_ship_tracks                   = false;
5134 % guiparams.plot_planview                      = false;
5135 % guiparams.plot_cross_section                 = false;
5136 
5137 % File location defaults
5138 guiparams.ascii_path                        = pwd;
5139 guiparams.ascii_file                        = '';
5140 guiparams.mat_path                          = pwd;
5141 guiparams.mat_file                          = '';
5142 guiparams.tecplot_path                      = pwd;
5143 guiparams.tecplot_file                      = '';
5144 guiparams.kmz_path                          = pwd;
5145 guiparams.kmz_file                          = '';
5146 guiparams.multibeambathymetry_path          = pwd;
5147 guiparams.multibeambathymetry_file          = '';
5148 guiparams.log_path                          = pwd;
5149 guiparams.log_file                          = '';
5150 % Avoids problems of not finding the MCR root when running as a standalone
5151 % application
5152 if isdeployed 
5153     guiparams.has_mapping_toolbox           = true;
5154 else
5155     guiparams.has_mapping_toolbox               = ...
5156         ~isempty(dir(fullfile(matlabroot,'toolbox','map')));
5157 end
5158 
5159 %%%%%%%%%%%%%%%%%%%%%%%%%%
5160 % IN MEMORY DATA STORAGE %
5161 %%%%%%%%%%%%%%%%%%%%%%%%%%
5162 guiparams.z                      = [];
5163 guiparams.A                      = [];
5164 guiparams.V                      = [];
5165 guiparams.Map                    = [];
5166 guiparams.savefile               = [];
5167 guiparams.iric_anv_planview_data = [];
5168 % guiparams.zmin = []; % Don't need to store these?
5169 % guiparams.zmax = [];
5170 % guiprefs = getappdata(handles.figure1,'guiprefs');
5171 guiparams.data_folder = '';
5172 guiparams.data_files  = {''};
5173 guiparams.gui_state   = 'init';
5174 
5175 % [EOF] createGUIparams
5176 
5177 function ShiptracksZoom_Callback(obj,evd,handles)
5178 ticks_format('%6.0f','%8.0f'); %formats the ticks for UTM (when zooming)
5179 
5180 function ShiptracksPan_Callback(obj,evd,handles)
5181 ticks_format('%6.0f','%8.0f'); %formats the ticks for UTM (when panning)
5182 
5183 % [EOF] VMT
5184 
5185 
5186 
5187 
5188 
5189 % --- Hidden keyboard commands
5190 function figure1_WindowKeyPressFcn(hObject, eventdata, handles)
5191 % Used to pass specific hidden keyboard commands to VMT. Currently, the
5192 % only use for this function is to open Beta support for SonTek M9 data.
5193 %
5194 % hObject    handle to figure1 (see GCBO)
5195 % eventdata  structure with the following fields (see FIGURE)
5196 %    Key: name of the key that was pressed, in lower case
5197 %    Character: character interpretation of the key(s) that was pressed
5198 %    Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
5199 % handles    structure with handles and user data (see GUIDATA)
5200 
5201 in1 = eventdata.Modifier; 
5202 in2 = eventdata.Key;
5203 
5204 if ~isempty(in1) % User pressed at least one modifier key
5205     input = [in1{:} in2];
5206 else
5207     input = in2;
5208 end
5209 
5210 switch input
5211     % Hidden SonTek M9 support
5212     case 'shiftcontrols'
5213         msgtxt = {...
5214             'VMT offers limited support for SonTek M9/S5 data.';...
5215             'SonTek RiverSurveyorLive required data format:';...
5216             '      -ENU coordinates';...
5217             '      -Desired GPS reference (BT/GGA/VTG)'
5218             '';...
5219             'Abosolutely NO GUARANTEE is made or implied that this';...
5220             'functionality will work for all cases. Results are';...
5221             'PROVISIONAL at best.'};
5222         msgbox(msgtxt, 'Hidden Functionality: Process SonTek M9', 'warn','replace')
5223         
5224         % Get the Application data:
5225         % -------------------------
5226         guiparams = getappdata(handles.figure1,'guiparams');
5227         guiprefs = getappdata(handles.figure1,'guiprefs');
5228         
5229         % Ask the user to select files:
5230         % -----------------------------
5231         % current_file = fullfile(guiparams.data_folder,guiparams.data_files{1});
5232         % current_file = fullfile(guiprefs.mat_path,guiprefs.mat_file);
5233         if iscell(guiprefs.mat_file)
5234             uifile = fullfile(guiprefs.mat_path,guiprefs.mat_file{1});
5235         else
5236             uifile = fullfile(guiprefs.mat_path,guiprefs.mat_file);
5237         end
5238         [filename,pathname] = ...
5239             uigetfile({'*.mat','MAT-files (*.mat)'}, ...
5240             'Select SonTek RiverSurveyor Live v3.60 MAT File', ...
5241             uifile, 'MultiSelect','on');
5242         
5243         if ischar(pathname) % The user did not hit "Cancel"
5244             guiparams.data_folder = pathname;
5245             if ischar(filename)
5246                 filename = {filename};
5247             end
5248             guiparams.data_files = filename;
5249             guiparams.mat_file = '';
5250             
5251             setappdata(handles.figure1,'guiparams',guiparams)
5252             
5253             
5254             
5255             % Update the preferences:
5256             % -----------------------
5257             guiprefs = getappdata(handles.figure1,'guiprefs');
5258             guiprefs.ascii_path = pathname;
5259             guiprefs.ascii_file = filename;
5260             setappdata(handles.figure1,'guiprefs',guiprefs)
5261             store_prefs(handles.figure1,'ascii')
5262             
5263             % Push messages to Log Window:
5264             % ----------------------------
5265             log_text = {...
5266                 '';...
5267                 ['%--- ' datestr(now) ' ---%'];...
5268                 'Current Project Directory:';...
5269                 guiparams.data_folder;
5270                 'Loading the following files into memory:';...
5271                 char(filename)};
5272             statusLogging(handles.LogWindow, log_text)
5273             
5274             % Read the file(s)
5275             % ----------------
5276             %A = parseSonTekVMT(fullfile(pathname,filename));
5277             
5278             [~,~,savefile,A,z] = ...
5279                 VMT_ReadFiles_SonTek(guiparams.data_folder,guiparams.data_files);
5280             guiparams.savefile = savefile;
5281             guiparams.A        = A;
5282             guiparams.z        = z;
5283             setappdata(handles.figure1,'guiparams',guiparams)
5284             
5285             
5286             % Update the GUI:
5287             % ---------------
5288             set_enable(handles,'fileloaded')
5289         end  
5290     case 'shiftcontroll' % Call SontekMAT2KML
5291         SontekMAT2KML;
5292     case 'f1' % Call the VMT UsersGuide
5293         menuUsersGuide_Callback(hObject, eventdata, handles)
5294         
5295     case 'controlalte'
5296         VMT_BuildCustomFlatFile;
5297     otherwise
5298         %disp(input)
5299 end

Generated on Thu 21-Aug-2014 10:40:31 by m2html © 2005