writesonproject.m

来自「利用matlab控制3维仿真软件sonnet的工具箱」· M 代码 · 共 33 行

M
33
字号
function [successful,filename]=WriteSonProject(OutputText,RunNumber)

% This function writes the Sonnet Project text to a file.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Author: Serhend Arvas, sarvas@syr.edu    %
% Part of Patch Antenna Design Code        %
% August 2007                              %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CurrentDir=cd; % Finds the Current Directory

% Constructs the FileName
filename=[CurrentDir '\SonnetProjectFiles\PatchAnt' num2str(RunNumber) '.son']; 
fid=fopen(filename,'w'); % Opens the file

% Sets a flag based on the success or failure of the open operation
if fid == -1
    successful = 0;
else
    successful = 1;
end

% writes the lines of the project file followed by newline characters.
for lineNum=1:length(OutputText)   
    line=OutputText{lineNum};
    fprintf(fid,line); 
    fprintf(fid,'\n');  
end

fclose(fid);  % Closes the file.

⌨️ 快捷键说明

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