% SBEACH toolbox - fsbeach_collectresults % Written by Joshua Simmons 02/2018 % Syntax: % dataout = fsbeach_readxvrfile(fid) % % Input: % fid = file id of .XVR file from which data is to be extracted % Output: % dataout = structure with sbeach data; function dataout = fsbeach_readxvrfile(fid) ln = fgets(fid); % first line %header material while ln(1) ~= '_' ln = fgets(fid); end for ii = 1:8 tmpd = []; while any(isletter(ln)) || ln(1) == '_' ln = fgets(fid); end while ln(1) ~= '_' && ~any(isletter(ln)) && ischar(ln) tmpd = [tmpd; sscanf(ln,'%f')]; ln = fgets(fid); end tmpdataout(ii).data = tmpd; end padlen = length(tmpdataout(1).data)-length(tmpdataout(2).data); %max value dataout.Hmax = padarray(tmpdataout(2).data,padlen,0,'pre'); dataout.TWLmax = padarray(tmpdataout(4).data,padlen,0,'pre'); dataout.depmax = padarray(tmpdataout(6).data,padlen,0,'pre'); %time step of max dataout.tsHmax = padarray(tmpdataout(3).data,padlen,0,'pre'); dataout.tsTWLmax = padarray(tmpdataout(5).data,padlen,0,'pre'); dataout.tsdepmax = padarray(tmpdataout(7).data,padlen,0,'pre'); end