How to plot data as a time series in a figure
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Haider Ali
il 29 Ott 2019
Commentato: Haider Ali
il 30 Ott 2019
HI,
I have a text file and I would like to plot the data as a time series in a figure.
0 Commenti
Risposta accettata
Akira Agata
il 30 Ott 2019
How about the following?
T = readtable('data.txt','HeaderLines',3,'ReadVariableNames',false);
T.Properties.VariableNames = {'TIME_BEGIN','TIME_END','TEMPERATURE'};
T.TIME_BEGIN = datetime(num2str(T.TIME_BEGIN),'Format','yyyyMMdd');
T.TIME_END = datetime(num2str(T.TIME_END),'Format','yyyyMMdd');
Time = reshape(T{:,{'TIME_BEGIN','TIME_END'}}',[],1);
Temperature = repelem(T.TEMPERATURE,2,1);
figure
plot(Time,Temperature)
ylabel('Temperature','FontSize',16)
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Annotations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!