home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / GRAPHICS.DI$ / META.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  2.4 KB  |  87 lines

  1. function meta(a,b)
  2. %META   PostScript hardcopy.
  3. %   The command is obsolete but grandfathered for users of
  4. %   earlier versions of MATLAB. Use PRINT instead.
  5. %
  6. %   Under MS-Windows(tm), META does nothing.
  7. %   If you wish to print to a file, choose the FILE: option
  8. %   on the ports list box in the printer driver installation
  9. %   dialog box.  The system will then prompt you for a filename
  10. %   when to make a print request.
  11. %
  12. %   META <filename> opens the file named 'filename.ps' and saves  
  13. %   the current Figure to it in PostScript form. Subsequent
  14. %   META commands may omit the filename, in which case the
  15. %   plots are appended to the previously named file. 
  16. %
  17. %   By default, META uses the PostScript driver '-dps'.
  18. %   META <filename> -ddevice specifies a different device driver.
  19. %   Available device options are:
  20. %
  21. %      -dps    - PostScript
  22. %      -dpsc   - Color PostScript
  23. %      -dps2   - Level 2 PostScript
  24. %      -dpsc2  - Level 2 Color PostScript
  25. %
  26. %   Note, some devices are not supported with META because
  27. %   they do not support multiple page file formats. For example
  28. %   Encapsulated PostScript (EPS). Use PRINT instead.
  29. %
  30. %   See also PRINT.
  31.  
  32. %   Copyright (c) 1984-93 by The MathWorks, Inc.
  33.  
  34.  
  35. disp('META is obsolete and will be eliminated in future')
  36. disp('versions.  Please use PRINT instead.')
  37. c = computer;
  38. if c(1:2) == 'PC'
  39.    return
  40. end
  41. % Emulate MATLAB 3.5 behavior.
  42. global MetaFileName
  43. global MetaDevice
  44.  
  45. % list of all devices that don't support '-append', for input validation
  46. devices = [
  47.     'eps  '
  48.     'epsc '
  49.     'eps2 '
  50.     'eps2c'
  51.     'epsc2'
  52. ];
  53.  
  54. % Use globals to remember metafile name and device in-between
  55. % invocations
  56. if nargin > 0
  57.     MetaFileName = a;
  58. end
  59.  
  60. if nargin == 2
  61.     % -append needed for print.m, but not all devices or file formats   
  62.     % support multiple pages, error out if user specified one of them
  63.     bwidth = size(b,2);
  64.     for r = 1:size(b,1)
  65.         if strcmp( deblank(b(3:bwidth)), deblank(devices(r,:)) )
  66.             error( [ 'Can not use device ''' b ''' with META. ' ...
  67.                      'Please use PRINT instead.' ] );
  68.         end
  69.     end
  70.     MetaDevice = b;
  71. end
  72.  
  73. if isempty(MetaDevice)
  74.     MetaDevice = '-dps';
  75. end
  76.  
  77. if isempty(MetaFileName)
  78.     MetaFileName = 'untitled.ps';
  79. end
  80.  
  81. % Append .ps to filename if not there already
  82. if ~any(MetaFileName == '.')
  83.     MetaFileName = [MetaFileName '.ps'];
  84. end
  85.  
  86. print(MetaFileName,MetaDevice,'-append')
  87.