I've written a concatnation loop that is supposed to make an array of NetCDF files. This is the code that I have:
sss_all=zeros(Nfiles, length(lon1), length(lat1));
for i = 1:Nfiles
ncfiles(i).name %this just helps my OCD in listing the name of the file
time1 = ncread(ncfiles(i).name, 'time');
sss = ncread(ncfiles(i).name, 'SSS');
sss_all(Nfiles, :, :) = sss;
It concatenates fine; however the 'time= datetime(1950,1,1)+days(time1);' function does not seem to function. It corrects the first files date from days since 01 01 1951 but then fills the rest of the dates with NaT. Any ideas what I am doing wrong?