function sheets = setSheets(Heakon,Rvaksas) %SETSHEETS Compose the sheetnames to be used for a computation % % The function composes the names of the sheets that must be used for the % computation. The combination of the Heakon number and Rvaksas number % defines the name of the sheet. % % Syntax: % sheets = setSheets(Heakon,Rvaksas) % % Input: % Heakon, Rvaksas = the numbers of the compartments % % Output: % sheets = the sheet names to be used % % 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: $ %% compose the sheet names % Two options for a sheet name % 1) just one Heakon number assigned to the compartments % name = 'Balans vak "Rvaksas" ("Heakon") % 2) more compartments with the same Heakon number % name = 'Balans vak "Heakon" used = ones(length(Heakon),1)*false; sheets = []; nrSheets = 0; while (true) first = -1; same = ones(length(Heakon),1)*false; teller = 0; HeakonNumber = -1; for n=1:length(Heakon) if ~used(n) same(n) = true; if first == -1 teller = teller + 1; first = n; HeakonNumber = Heakon(n); used(n) = true; else if HeakonNumber == Heakon(n) end end end end if teller > 0 nrSheets = nrSheets + 1; if teller > 1 sheets{nrSheets}=['Balans vak ' num2str(Heakon(first))]; else sheets{nrSheets}=['Balans vak ' num2str(Rvaksas(first)) ' (' num2str(Heakon(first)) ')']; end else break end end %