figureprep.m 771 B

12345678910111213141516171819202122232425262728293031323334
  1. function fig = figureprep(pos,wantvisible)
  2. % function fig = figureprep(pos,wantvisible)
  3. %
  4. % <pos> (optional) is a position like in setfigurepos.m
  5. % <wantvisible> (optional) is whether to keep the window visible. default: 0.
  6. %
  7. % make a new invisible figure window and set hold on.
  8. % then, if <pos> is supplied, set the position of the window.
  9. % return a handle to the figure window.
  10. %
  11. % use in conjunction with figurewrite.m.
  12. %
  13. % example:
  14. % figureprep;
  15. % scatter(randn(100,1),randn(100,1));
  16. % figurewrite;
  17. % input
  18. if ~exist('pos','var') || isempty(pos)
  19. pos = [];
  20. end
  21. if ~exist('wantvisible','var') || isempty(wantvisible)
  22. wantvisible = 0;
  23. end
  24. % do it
  25. fig = figure; hold on;
  26. if ~wantvisible
  27. set(fig,'Visible','off');
  28. end
  29. if ~isempty(pos)
  30. setfigurepos(pos);
  31. end