how do I use datetick for this code?

1 回表示 (過去 30 日間)
Susan Santiago
Susan Santiago 2018 年 9 月 23 日
コメント済み: Star Strider 2018 年 9 月 23 日
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 件のコメント
Susan Santiago
Susan Santiago 2018 年 9 月 23 日
that did it! Thanks for your help!
Star Strider
Star Strider 2018 年 9 月 23 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTitle についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by