Run:
/usr/bin/time -o time_main_plots.txt matlab -nodesktop -nosplash -logfile main_plots.log -r "main_plots;quit;"
Save figures in command line mode:
set(gcf, 'Visible', 'off')
Plots:
s1=subplot(nr,nc,1)
p=pcolor(...)
get(p)
set(p, 'edgecolor', 'none')
a=[1,2,3;4,5,6]
imagesc(a); colorbar()
contourf(a)
image(a); colorbar()
p=pcolor(a); colorbar(); shading flat %or set(p, 'edgecolor', 'none')
Plot Time Series:
close all;
set(gcf,'PaperUnits','inches','PaperPosition',[0 0 8 6])
plot(t1,elev, 'r-+')
hold on;plot(t1,repmat(zbathy, length(t1),1),'k-'); hold off
hold on;plot(t1,u9d, 'b*-'); hold off
hold on;plot(t1,v9d, 'go-'); hold off
legend('elev','zbathy', 'u9d', 'v9d')
xlim([w1 w2]);
datetick('x','dd-mmm-yyyy', 'keeplimits');
print('-dpng', [fname '_dry_points2.png'], '-r100');
Remove rows:
a(ind,:)=[];
Read CSV time series (not all numeric so can't use csvread):
fid = fopen([fileinpref '.csv']);
C = textscan(fid, '%s %f %f %f', 'delimiter', ',', 'HeaderLines',1);
fclose(fid);
C
C{1}
C{2}
t = datenum(C{1},'yyyy-mm-dd HH:MM:SS');
datestr(t(1:10))
Write tab delimited files, with header:
fileout='temp.txt';
del=char(9);
hd=['a' del 'b' del 'c'];
a=1:3;
fmt=['%d' del '%d' del '%d' '\n'];
fid=fopen(fileout, 'wt');
fprintf(fid, '%s\n', hd);
fprintf(fid, fmt, a);
fclose(fid);