function [tbeg,tend,nstat,sm,ss,su,sv] = read_statistics_channel_scal_ucf(file,varargin) % Parse optional input arguments par = inputParser; addParamValue(par,'verbosity',0,@isnumeric); addParamValue(par,'debug',0,@isnumeric); parse(par,varargin{:}); % Open UCF file and read obj = ucf('verbosity',par.Results.verbosity,'debug',par.Results.debug); switch class(file) case 'char' obj.open(file); case {'ustar','ucfmulti'} ptr = file.pointer('statistics_scal.bin'); obj.opentar(ptr); otherwise error('Input file type not supported: %s',class(file)); end tend = obj.getSimulationTime(); % Read parameters of first set params = obj.readParameters(1,1) % Parse parameters tbeg = typecast(params(1),'double'); nstat = cast(params(2),'double'); ny = cast(params(3),'double'); nscal = cast(params(4),'double'); % number of scal nset = cast(params(5),'double'); % number of stats sm = zeros(ny,nscal); ss = zeros(ny,nscal); su = zeros(ny,nscal); sv = zeros(ny,nscal); for iscal=1:nscal sm(:,iscal) = obj.readSet(1,(iscal-1)*4+1)/nstat; ss(:,iscal) = obj.readSet(1,(iscal-1)*4+2)/nstat; su(:,iscal) = obj.readSet(1,(iscal-1)*4+3)/nstat; sv(:,iscal) = obj.readSet(1,(iscal-1)*4+4)/nstat; end % Close file obj.close(); end