% script to load in .txt files of pumice weight % created by Kristen in March 2017 clear all M=csvimport('20171005_ML03_620_dry_weight.txt'); %Time=zeros(floor(length(M)/2),1); %extract time %% for i=2:2:length(M) Time(i/2)=(M(i,1)); Time2(i/2)=datenum(Time(i/2)); end t=datetime(Time);%store as datetime array [y,m,d]=ymd(t(1));%save date of experiment to add to use in temperature processing y=y+2000;%make year 2017 %% for i=3:2:length(M) Weight((i-1)/2)=(M(i,1)); Weight2((i-1)/2)=str2num(cell2mat(Weight((i-1)/2))); end %% figure yyaxis left plot(Time2(1:length(Weight2)),Weight2,'x'); set(gca,'FontSize',20); datetick('x') xlabel('time (HH:MM)'); ylabel('Submerged weight (g)'); %% %Load and plot the corresponding temperature data %Run ProcTemp first Temp_data=textread('20171005_ML03_620_2'); Temp=Temp_data(:,2);%TC temp Time_T=Temp_data(:,1);%this gives time in seconds since the start of a day Background=Temp_data(:,3);%background temp %% %Construct matlab data%% hr=floor(Time_T/3600); min=floor((Time_T-hr*3600)/60); sec=Time_T-hr*3600-min*60; %Lable day from Ohaus data Time_T2=datetime(y,m,d,hr,min,sec);%Create date string Time_T3=datenum(Time_T2); %% yyaxis right plot(Time_T3,Temp,'o'); hold on plot(Time_T3,Background,'x'); datetick('x'); ylabel('Internal Temperature (C)'); ylim([0 800]); %% %Pick a time to start from [x,y] = ginput(1); % now plot first 20 mins of the experiment figure; yyaxis left plot(Time2(1:length(Weight2)),Weight2,'x'); set(gca,'FontSize',20); xlabel('time (minutes)'); ylabel('Submerged weight (g)'); ylim([9,17]); yyaxis right plot(Time_T3,Temp,'o'); datetick('x'); ylabel('Internal Temperature (C)'); TotalTime=60*2;%Total time to show in seconds temp=datestr(x); [y,m,d,hh,mm,ss]=datevec(temp); EndTime=datetime(y,m,d,hh,mm,ss+TotalTime);%add fifteen minutes EndTime=datenum(EndTime); xlim([x,EndTime]); % Now label axis clear labels labels 2 skip=60; for i=skip:skip:TotalTime labels(i/skip)=x+((EndTime-x)/TotalTime)*i; labels2{i/skip}=num2str(i);%labels in seconds end xticks(labels) labels3=1:length(labels2);%labels in minutes (only if skip = 60) xticklabels(labels3); %xticklabels({'1','2','3','4','5','6','7','8','9','10'})