function [Rvaksas,Heakon,success] = getVakken(indeling,selection,varargin) %GETVAKKEN get the compartments to be used. % % For the given combination of selection and the information in the varargin % parameter, all compartments to be used are select from the "indeling" sheet. % Both the Rvaksas and the Heakon numbers are returned to be able to % compose correct sheetnames. % % Syntax: % [Rvaksas,Heakon] = getVakken(indeling,selection,varargin) % % Input: % indeling = the sheet with the combinations of compartments, macrocells % and tide information. % selection = what main selection of the classification is given % (macrocell, Rvaksas or Heakon) % varargin = the information from this parameter depends from selection % selection='macrocell': trenchtype, set of macrocells % selection='Heakon' or 'Rvaksas': set of compartments % % Output: % Rvaksas, Heakon = the compartment numbers for the selection and set % combination % success = the get is or is not successfull % % 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: 07 Sep 2010 % Created with Matlab version: 7.8.0.347 (R2009a) % $Id: $ % $Date: $ % $Author: $ % $Revision: $ % $HeadURL: $ % $Keywords: $ %% initialize success = true; Rvaksas = []; Heakon = []; %% get the compartment numbers records = ones(length(indeling)-2,1)*false; if strcmpi(selection,'macrocell') if nargin < 2 errordlg(sprintf('For selection "macrocell" two varargin parameters are needed.')); success = false; else trench = varargin{1}; set = varargin{2}; for n = 1:length(set) for m = 3:length(indeling(:,1)) a=indeling{m,4}; if isset(set(n)) s = cell2num(set(n)) else s = set(n) if set(n) == a switch trench case 'flood' if indeling{m,5} == 'v' records(m-2) = true; end case 'ebb' if indeling {m,5} == 'e' records(m-2) = true; end case 'trenches' if indeling{m,5} == 'e' || indeling{m,5} == 'v' records(m-2) = true; end case 'all' records(m-2) = true; otherwise if isnan(indeling{m,5}) records(m-2) = true; end end end end end end else if strcmpi(selection,'heakon') index = 3; else index = 2; end for n = 1:length(set) for m = 3:length(indeling) if set(n) == indeling{m,index} records(m-2) = true; end end end end teller = 0; for n=1:length(records) if records(n) teller = teller + 1; Heakon(teller) = indeling{n+2,3}; Rvaksas(teller) = indeling{n+2,2}; end end