⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 printfm.m

📁 阵列信号处理的工具箱
💻 M
字号:
function printfm(fileName, figNo, figSize, figHeight, colorFlag, previewFlag, uiControlFlag)%PRINTFM Create file output of a Matlab figure suitable to import in FrameMaker.%%--------%Synopsis:%  printfm(fileName)%  printfm(fileName, figNo)%  printfm(fileName, figNo, figSize)%  printfm(fileName, figNo, figSize, figHeight)%  printfm(fileName, figNo, figSize, figHeight, colorFlag)%  printfm(fileName, figNo, figSize, figHeight, colorFlag, previewFlag)%  printfm(fileName, figNo, figSize, figHeight, colorFlag, previewFlag, %    uiControlFlag)%%Description:%  Create file output of a Matlab figure suitable to import in FrameMaker%  or other word processing programs. With the input%  parameter "figSize" it is possible allready in Matlab to specify the size%  of the figure in the FrameMaker document. The size of most text in the%  figure is not changed.%%Output and Input:%  fileName (StringT): EPSI-file to create. Full file path and extension must%    be given.%  figNo [D](IntScalarT): Figure to print. Default is curret figure (gfc).%  figSize [D](RealScalarT): Width of figure in centimeters. The height will%    be scaled accordingly if input parameter "figHeight" is omitted.%  figHeight [D](RealScalarT): Height of figure in centimeters. The height%    will be scaled accordingly to the width if input parameter "figHeight"%    is omitted.%  colorFlag [D](BoolT): Whether to print in color (=1, default) or not (=0). %  previewFlag [D](BoolT): Whether to add a preview image that can be seen%    on screen in a word processor (=1) or not (=0, default). This preview%    is suitable for Microsift Word 97 but it can not be used for FrameMaker%    5.1.%  uiControlFlag [D](BoolT): Whether to print the user inteface controls,%    e.g. buttons and popup menus, which are present in the figure window%    (=1, default) or not (=0).%%--------%Notations:%  Data type names are shown in parentheses and they start with a capital%  letter and end with a capital T. Data type definitions can be found in [1]%  or by "help dbtdata".%  [D] = This parameter can be omitted and then a default value is used.%  When the [D]-input parameter is not the last used in the call, it must be%  given the value [], i.e. an empty matrix.%  ... = There can be more parameters. They are explained under respective%  metod or choice.%%Examples:%Software Quality:%  (About what is done to ascertain software quality. What tests are done.)%Known Bugs:%%References:%  [1]: Bj鰎klund S.: "DBT, A MATLAB Toolbox for Radar Signal Processing.%    Reference Guide", FOA-D--9x-00xxx-408--SE, To be published.%%See Also:%  print%   *  DBT, A Matlab Toolbox for Radar Signal Processing  *% (c) FOA 1994-2000. See the file dbtright.m for copyright notice.%%  Start        : 980715 Svante Bj鰎klund (svabj).%  Latest change: $Date: 2001/08/31 15:04:29 $ $Author: svabj $.%  $Revision: 1.11 $% *****************************************************************************%  A level 1 color%  Encapsulated PostScript (EPS) file is written to disk. A color TIFF%  preview to the Encapsulated PostScript is added.% ----------------------------------------------------------------------- %% Handle input parameters% ----------------------------------------------------------------------- %if (nargin < 1)  error('DBT-Error: To few input parameters.')end% ****************** Add missing input parameters ******************arginNo=2;if (nargin < arginNo)  figNo = [];endarginNo = arginNo +1;if (nargin < arginNo)  figSize = [];endarginNo = arginNo +1;if (nargin < arginNo)  figHeight = [];endarginNo = arginNo +1;if (nargin < arginNo)  colorFlag = [];endarginNo = arginNo +1;if (nargin < arginNo)  previewFlag= [];endarginNo = arginNo +1;if (nargin < arginNo)  uiControlFlag= [];endarginNo = arginNo +1;% ****************** Convert from strings to numbers ******************if ischar(figNo)  figNo = str2num(figNo);end%ifif ischar(figSize)  figSize = str2num(figSize);end%ifif ischar(figHeight)  figHeight = str2num(figHeight);end%ifif ischar(colorFlag)  colorFlag = str2num(colorFlag);end%ifif ischar(previewFlag)  previewFlag= str2num(previewFlag);end%ifif ischar(uiControlFlag)  uiControlFlag= str2num(uiControlFlag);end%if% ****************** Default values ******************oldCurrentFig = gcf;if isempty(figNo)  figNo = oldCurrentFig;end%ifif isempty(colorFlag)  colorFlag = 1;end%ifif isempty(previewFlag)  previewFlag = 0;end%ifif isempty(uiControlFlag)  uiControlFlag = 1;end%if% ******************  ******************figure(figNo);%if (~uiControlFlag)%  disp('Removing user interface controls.')%  axesHandle = gca;%  tempFig = figure;%  set(tempFig,'Children',axesHandle)%end%ifoldPaperPos = get(gcf,'PaperPosition');oldPaperUnits = get(gcf,'PaperUnits');% Convert 'PaperPosition' to centimeters.if strcmp(oldPaperUnits,'inches')  paperPos = oldPaperPos*2.54;    % Old paper position in cm.elseif strcmp(oldPaperUnits,'points')  paperPos = oldPaperPos*2.54* (1/72);elseif strcmp(oldPaperUnits,'normalized')  % For A4 paper size.  paperPos(1) = oldPaperPos(1)*21.0;  paperPos(2) = oldPaperPos(2)*29.7;  paperPos(3) = oldPaperPos(3)*21.0;  paperPos(4) = oldPaperPos(4)*29.7;elseif strcmp(oldPaperUnits,'centimeters')  paperPos = oldPaperPos;else  error('DBT-Error: Unknown PaperUnits type.')end%ifaspectRatio = (paperPos(4)/paperPos(3));% ----------------------------------------------------------------------- %% Main part.% ----------------------------------------------------------------------- %old = 0;if (old)if isempty(figSize)  figSize = oldPaperPos(3:4);end%ifnewWidth = figSize(1);paperPos(3:4) = [newWidth, (newWidth/paperPos(3))*paperPos(4)];else %(old), i.e. new.%disp('printfm new')if isempty(figSize)  figSize = oldPaperPos(3);end%ifif isempty(figHeight)  figHeight = aspectRatio*figSize;end%ifnewWidth = figSize;newHeight = figHeight;paperPos(3:4) = [newWidth, newHeight];end%if (old)set(gcf,'PaperUnits','centimeters')set(gcf,'PaperPosition',paperPos)if (colorFlag)  printDeviceType = '-depsc2';else  printDeviceType = '-deps2';end%ifif (~uiControlFlag)  restParams = {'-noui'};else  restParams = {};end%if%disp('Just before print command.')if (previewFlag)  print(printDeviceType, '-tiff', restParams{:}, fileName)    % The -tiff option does not seem to work. It creates some rubbish in    %  the EPS-file and that makes FrameMaker 5.1 crash.    % When using the -epsi option Matlab crashes.    %print('-deps2', '-epsi', fileName)else  print(printDeviceType, restParams{:}, fileName)end%if%disp('Just after print command.')% ----------------------------------------------------------------------- %% Clean up.% ----------------------------------------------------------------------- %set(gcf,'PaperUnits',oldPaperUnits)set(gcf,'PaperPosition',oldPaperPos)%if (~uiControlFlag)%  close(tempFig)%end%iffigure(oldCurrentFig)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -