this is the code I have so far. The part in the loop is from code I wrote for just one of the files. I want to change it so that a different file is opened with each loop but i'm not sure how. Thanks for any help
maxit=42;i=1;while i < maxit 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 = datenum(B_time,'yyyymmddHHMM'); CO2 = A{1,3}; H2O = A{1,5}; FC = A{1,7}; LE = A{1,9}; ET = A{1,11}; H = A{1,13}; G = A{1,15}; SG = A{1,16}; WD = A{1,21}; WS = A{1,22}; ZL = A{1,25}; TA1 = A{1,36}; TA2 = A{1,39}; RH1 = A{1,37}; RH2 = A{1,40}; VPD = A{1,42}; SWin = A{1,52}; SWout = -A{1,53}; LWin = A{1,54}; LWout = -A{1,55}; ALB = A{1,50}; figure() plot(x,CO2) legend('CO2') datetick('x','dd-mmm-yyyy HH:MM:SS','keeplimits','keepticks') figure() plot(x,H2O) legend('H2O') datetick('x','dd-mmm-yyyy HH:MM:SS','keeplimits','keepticks') figure() plot(x,FC) legend('FC') datetick('x','dd-mmm-yyyy HH:MM:SS','keeplimits','keepticks') figure() hold on plot(x,LE) plot(x,H) legend('LE','H') datetick('x','dd-mmm-yyyy HH:MM:SS','keeplimits','keepticks') hold off figure() hold on plot(x,G) plot(x,SG) legend('G','SG') hold off figure() plot(x,WS) legend('WS') datetick('x','dd-mmm-yyyy HH:MM:SS','keeplimits','keepticks') figure() plot(x,ZL) legend('ZL') datetick('x','dd-mmm-yyyy HH:MM:SS','keeplimits','keepticks') figure() hold on plot(x,TA1) plot(x,TA2) legend('TA1','TA2') datetick('x','dd-mmm-yyyy HH:MM:SS','keeplimits','keepticks') hold off figure() hold on plot(x,RH1) plot(x,RH2) legend('RH1','RH2') datetick('x','dd-mmm-yyyy HH:MM:SS','keeplimits','keepticks') hold off figure() plot(x,VPD) legend('VPD') datetick('x','dd-mmm-yyyy HH:MM:SS','keeplimits','keepticks') figure() plot(x,ALB) legend('ALB') datetick('x','dd-mmm-yyyy HH:MM:SS','keeplimits','keepticks') figure() hold on plot(x,SWin) plot(x,SWout) plot(x,LWin) plot(x,LWout) legend('SWin','SWout','LWin','LWout') datetick('x','dd-mmm-yyyy HH:MM:SS','keeplimits','keepticks') hold off i=i+1;end
Best Answer