1function ftest (s1,s2) 2 3% Copyright (C) 2001-2017 Dynare Team 4% 5% This file is part of Dynare. 6% 7% Dynare is free software: you can redistribute it and/or modify 8% it under the terms of the GNU General Public License as published by 9% the Free Software Foundation, either version 3 of the License, or 10% (at your option) any later version. 11% 12% Dynare is distributed in the hope that it will be useful, 13% but WITHOUT ANY WARRANTY; without even the implied warranty of 14% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15% GNU General Public License for more details. 16% 17% You should have received a copy of the GNU General Public License 18% along with Dynare. If not, see <http://www.gnu.org/licenses/>. 19 20global nvx nvy x y lag1 21 22if size(s1,1) ~= 2 23 error ('Spécifiez deux fichiers pour la comparaison.') ; 24end 25 26for i = 1:2 27 if ~ isempty(find(abs(s1(i,:)) == 46)) 28 error ('Entrez les noms de fichiers sans extensions.') ; 29 end 30end 31 32s1 = [s1 [' ';' ']] ; 33file1 = [s1(1,1:min(find(abs(s1(1,:)) == 32))-1) '.BIN'] ; 34file2 = [s1(2,1:min(find(abs(s1(2,:)) == 32))-1) '.BIN'] ; 35 36fid=fopen(file1,'r') ; 37n1 = fread(fid,1,'int') ; 38n2 = fread(fid,1,'int') ; 39n3 = fread(fid,1,'int') ; 40lag1 = fread(fid,4,'int') ; 41nvx = fread(fid,[n1,n3],'int') ; 42x = fread(fid,[n1,n2],'float64') ; 43fclose(fid) ; 44nvx = char(nvx) ; 45 46fid=fopen(file2,'r') ; 47n1 = fread(fid,1,'int') ; 48n2 = fread(fid,1,'int') ; 49n3 = fread(fid,1,'int') ; 50lag2 = fread(fid,4,'int') ; 51nvy = fread(fid,[n1,n3],'int') ; 52y = fread(fid,[n1,n2],'float64') ; 53fclose(fid) ; 54nvy = char(nvy) ; 55 56if size(x,1) ~= size(y,1) 57 error ('FTEST: The two files don''t have the same number of variables.'); 58end 59 60for i = 1:size(x,1) 61 if ~ strcmp(nvx(i,:),nvy(i,:)) 62 error ('FTEST: The two files don''t have the same variables.') ; 63 end 64end 65 66if nnz(lag1 - lag2) > 0 67 error ('FTEST: Leads and lags aren''t the same in both files.') ; 68end 69 70j = zeros(size(s2,1),1); 71for i=1:size(s2,1) 72 k = strmatch(s2(i,:),nvx,'exact') ; 73 if isempty(k) 74 t = ['FTEST: Variable ' s2(i) 'doesn''t exist'] ; 75 error (t) ; 76 else 77 j(i) =k; 78 end 79end 80 81y = y(j,:) ; 82x = x(j,:) ; 83 84%06/18/01 MJ replaced beastr by strmatch 85