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.

21 lines
718 B
Matlab

function [pfdataout] = formatpfdata(xin,zin,interpspace)
% Written by Joshua Simmons 11/02/2015 - to format profile data as
% required (linear interploation etc etc
% Input:
% xin = cross shore
% zin = elevation
% interppspace = regular spacing of the profile to be linearly
% interpolated to. Leave as "NaN" if raw input points to
% be used.
% Output:
% structure with .x,.z formatted as required.
if isnan(interpspace)
pfdataout.x = xin;
pfdataout.z = zin;
else
minx = min(xin);
maxx = max(xin);
pfdataout.x = [minx:interpspace:maxx];
pfdataout.z = interp1(xin,zin,pfdataout.x);
end
end