
matfile = dir(fullfile(cd,'*.mat'));

for i = 1:length(matfile)
    buoyname = strrep(matfile(i).name,'.mat','');
    if strcmp(buoyname,'42007')==1
        fieldname = 'shallow_water';
    else if strcmp(buoyname,'42040')==1
            fieldname = 'deep_water';
        end
    end
    temp = load(matfile(i).name);
    data.(fieldname).WVHT = temp.D.stdmet.wave_height;
    data.(fieldname).Time = temp.D.stdmet.time;
    fieldnames{i,:}=fieldname;
end
figure()
i=1;
plot(data.(fieldnames{i,1}).Time,data.(fieldnames{i,1}).WVHT)
