% optiGTest class of test functions/problems w/- or w/o constraint(s) L. LAURENT -- 15/04/2018 -- luc.laurent@lecnam.net
0001 %% optiGTest class of test functions/problems w/- or w/o constraint(s) 0002 % L. LAURENT -- 15/04/2018 -- luc.laurent@lecnam.net 0003 0004 % sources available here: 0005 % https://bitbucket.org/luclaurent/optigtest/ 0006 % https://github.com/luclaurent/optigtest/ 0007 0008 % optiGTest - set of testing functions A toolbox to easy manipulate functions. 0009 % Copyright (C) 2018 Luc LAURENT <luc.laurent@lecnam.net> 0010 % 0011 % This program is free software: you can redistribute it and/or modify 0012 % it under the terms of the GNU General Public License as published by 0013 % the Free Software Foundation, either version 3 of the License, or 0014 % (at your option) any later version. 0015 % 0016 % This program is distributed in the hope that it will be useful, 0017 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0018 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0019 % GNU General Public License for more details. 0020 % 0021 % You should have received a copy of the GNU General Public License 0022 % along with this program. If not, see <http://www.gnu.org/licenses/>. 0023 0024 %% function display table with two columns of text 0025 0026 function txt=dispTableTwoColumns(tableA,tableB,separator) 0027 %size of every components in tableA 0028 sizeA=cellfun(@numel,tableA); 0029 maxA=max(sizeA); 0030 %space after each component 0031 spaceA=maxA-sizeA+2; 0032 if nargin>2 0033 spaceTxt=separator; 0034 else 0035 spaceTxt=' '; 0036 end 0037 txtOk=[]; 0038 %display table 0039 for itT=1:numel(tableA) 0040 if ischar(tableB{itT}) 0041 mask='%s%s%s\n'; 0042 elseif isinteger(tableB{itT}) 0043 mask='%s%s%i\n'; 0044 else 0045 mask='%s%s%+5.4e\n'; 0046 end 0047 % 0048 txtOk=[txtOk sprintf(mask,tableA{itT},[' ' spaceTxt(ones(1,spaceA(itT))) ' '],tableB{itT})]; 0049 end 0050 if nargout==1 0051 txt=txtOk; 0052 else 0053 Ofprintf(txtOk); 0054 end 0055 end