how do I use datetick for this code?

2 次查看(过去 30 天)
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

采纳的回答

Star Strider
Star Strider 2018-9-23
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.
  4 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Title 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by