function save_all_figures(location)

f = findobj('type', 'figure');
for i=1:numel(f)
  figure(f(i).Number);
  n = get(f(i), 'name');
  if isempty(n)
    n = 'unknown';
  end
  
  filename = fullfile(location, [datestr(now, 'yyyymmddTHHMMSSFFF') ' ' n]);
  
  % figfile = [filename '.fig'];
  % savefig(figfile);
  % fprintf('saving to %s\n', figfile);

  pngfile = [filename '.png'];
  print(pngfile, '-dpng');
  fprintf('saving to %s\n', pngfile);

end
