function [sheets,vakken,success] = getSheetCombination(file, OPT, theSheets) %GETSHEETCOMBINATION define the sheets to be used for the volume computation. % % With OPT, the function is told what computation is asked for. This function first % searches what compartments must be used an then selects the appropriate % sheets fro the given sheets collection (theSheets found in the Excell file). % % Syntax: % [sheets,vakken,success] = getSheetCombination(OPT, theSheets) % % Input: % file = the name of the excell file % OPT = options used to inform what computation is asked for % theSheets = the sheets in the excell database % % Output: % sheets = the sheets to be used in the combination % vakken = a structure that gives the numbers of the compartments to be % used: Rvaksas and Heakon % success = is the search sucessfull % % Example % % See also %% Copyright notice % -------------------------------------------------------------------- % Copyright (C) 2010 % Lou Verhage % % % %
% % This library is free software: you can redistribute it and/or % modify it under the terms of the GNU Lesser General Public % License as published by the Free Software Foundation, either % version 2.1 of the License, or (at your option) any later version. % % This library is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU % Lesser General Public License for more details. % % You should have received a copy of the GNU Lesser General Public % License along with this library. If not, see . % -------------------------------------------------------------------- % This tool is part of OpenEarthTools. % OpenEarthTools is an online collaboration to share and manage data and % programming tools in an open source, version controlled environment. % Sign up to recieve regular updates of this function, and to contribute % your own tools. %% Version % Created: 06 Sep 2010 % Created with Matlab version: 7.8.0.347 (R2009a) % $Id: $ % $Date: $ % $Author: $ % $Revision: $ % $HeadURL: $ % $Keywords: $ %% Initialize success = true; sheets = []; vakken.Heakon = []; vakken.Rvaksas = []; %get the indelings information [dummy1,dummy2,indeling] = xlsread(file,'indeling rekenvakken'); % check the selection type and related selections switch (lower(OPT.selection)) case 'macrocel' if isempty(OPT.set) errordlg(sprintf('For selection: %s \n "set" must be given with a macrocel number.',OPT.selection),'!!Selection error!!','modal'); success = false; end switch (lower(OPT.trenchtype)) case {'all','flood','ebb','','trenches'} [Rvaksas,Heakon,success] = getVakken(indeling,lower(OPT.selection),lower(OPT.trenchtype),OPT.set); otherwise errordlg(sprintf('Wrong selection for macrocell: %s \n Allowed: flood, ebb, trenches, all or "empty".',OPT.trenchtype),'!!Selection error!!','modal'); success = false; end case {'heakon','compartments'} if isempty(OPT.set) errordlg(sprintf('For selection: %s \n "set" must be given to select compartments.',OPT.selection),'!!Selection error!!','modal'); success = false; else [Rvaksas,Heakon,success] = getVakken(indeling,lower(OPT.selection),OPT.set); end otherwise errordlg(sprintf('Wrong selection: %s \n Allowed: macrocell, heakon, compartments.',OPT.selection),'!!Selection error!!','modal'); success = false; end if ~success return end %% select the sheets for the computation (and set vakken that are used) vakken.Rvaksas = Rvaksas; vakken.Heakon = Heakon; sheets = setSheets(Rvaksas,Heakon);