MATLAB: How to use datetick for this code

datetickgraphplot

A = textscan(fopen('7633_Flux_AmeriFluxFormat_3.dat'),'%f %f %f %f %f %f %f %f %f %f %f %f %f %f %s %s %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %s %s %f %f %f %f %f %f %f %f', 'Delimiter',',','Headerlines',1);
A_time = A{1,1};
B_time = num2str(A_time);
x_serial = datenum(B_time,'yyyymmddHHMM');
x = datetick('x','dd-mmm-yyyy HH:MM:SS','keeplimits')
CO2 = A{1,3};
figure()
plot(x,CO2)
this is the first part of my code. my x-axis is currently in matlab serial numbers. When I try running this, it says there are too many output arguments in the datetick line. I've never used datetick before. Please tell me what i'm doing wrong and how to fix it

Best Answer

I would code it differently:
fidi = fopen('7633_Flux_AmeriFluxFormat_3.dat');
A = textscan(fidi,'%f %f %f %f %f %f %f %f %f %f %f %f %f %f %s %s %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %s %s %f %f %f %f %f %f %f %f', 'Delimiter',',','Headerlines',1);
fclose(fidi);
A_time = A{1,1};
B_time = num2str(A_time);
x_serial = datenum(B_time,'yyyymmddHHMM');
CO2 = A{1,3};
figure()
plot(x,CO2)
datetick('x','dd-mmm-yyyy HH:MM:SS','keeplimits')
I do not have your file, so I am stating that this is*_UNTESTED CODE_*. You will have to see if it works.