Effacer les filtres
Effacer les filtres

making 365 daily plots from one year data file using one syntax and saving them at the same time using the each date as the figure file name

1 vue (au cours des 30 derniers jours)
I have a three days data file from which I want to make three figures and to save simultaneously (In fact, I want to apply this for one year data). I should have 1440 data points for each day (one minute data)that I want to scale in 24 hour frame (for each day) but for the 2nd and 3rd days I have missing data (<1440). So, how can I make the loop so that after making the first plot for 1440 data the loop will switch to the 2nd and 3rd day for the 2nd and 3rd plots. I want to use the first day (e.g. 2010-01-01, 2010-01-02, 2010-01-03) as the figure title from the file for the first figure and so on. I used the following code that generates the figure for the first day but I don't know how to make the loop for three plots at a time that I want to save using the title as the file name for the figure. Would you please help me to get rid of this stuck position?
close all; clear all; clc;
fid = fopen('daily plot_test.txt','r');
data_f1=textscan(fid,'%s %s %f %f %f %f %f', 'delimiter', ' ', 'collectoutput',1,'headerlines',1);
fclose(fid)
data1 = data_f1{1,1};
data2 = data_f1{1,2};
A = data1(:,1);
X = cell2mat(A);
P = datenum(X);
B = data1(:,2);
Y = cell2mat(B);
Z = datenum(Y);
C = data2(:,1);
D = data2(:,2);
E = data2(:,3);
F = data2(:,4);
x = linspace(0,24,length(Z))
subplot(2,2,1);
plot(x,C,'ro-','MarkerSize',2)
set(gca,'xlim',[0 24],'xtick',[0:2:24],...
'xticklabel',[0:2:24])
ylabel('O_3 (ppb)','FontSize',12);
xlabel('Time (hours)','FontSize',12);
title(X(1,:));
subplot(2,2,2);
plot(x,D,'bo-','MarkerSize',2);
set(gca,'xlim',[0 24],'xtick',[0:2:24],...
'xticklabel',[0:2:24])
ylabel('Tb','FontSize',12);
xlabel('Time (hours)','FontSize',12);
title(X(1,:));
subplot(2,2,3);
plot(x,E,'go-','MarkerSize',2);
set(gca,'xlim',[0 24],'xtick',[0:2:24],...
'xticklabel',[0:2:24])
ylabel('TL','FontSize',12);
xlabel('Time (hours)','FontSize',12);
title(X(1,:));
subplot(2,2,4);
xxx = plot(x,F,'mo-','MarkerSize',2);
set(gca,'xlim',[0 24],'xtick',[0:2:24],...
'xticklabel',[0:2:24])
ylabel('Prs','FontSize',12);
xlabel('Time (hours)','FontSize',12);
title(X(1,:));
annotation('rectangle', [.04 .04 .90 .93], 'EdgeColor', 'r');
print -dpdf title.pdf
  2 commentaires
Walter Roberson
Walter Roberson le 12 Août 2012
Please review the Guide To Tags and retag this question. Please do not tag questions with the names of individuals. See http://www.mathworks.co.uk/matlabcentral/answers/43073-a-guide-to-tags
Md. Moklesur Rahman
Md. Moklesur Rahman le 12 Août 2012
Thanks for clarification and apologize for the misunderstanding.

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 25 Sep 2012

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by