You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2 KiB
Matlab

7 years ago
% 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