Borrar filtros
Borrar filtros

how do I use datetick for this code?

2 visualizaciones (últimos 30 días)
Susan Santiago
Susan Santiago el 23 de Sept. de 2018
Comentada: Star Strider el 23 de Sept. de 2018
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

Respuesta aceptada

Star Strider
Star Strider el 23 de Sept. de 2018
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 comentarios
Susan Santiago
Susan Santiago el 23 de Sept. de 2018
that did it! Thanks for your help!
Star Strider
Star Strider el 23 de Sept. de 2018
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by