searchfile.m
来自「利用matlab控制3维仿真软件sonnet的工具箱」· M 代码 · 共 36 行
M
36 行
function Found=SearchFile(filename,txt)
% This file returns true if the file with name "filename" exists AND the
% text in txt is in the file.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Author: Serhend Arvas, sarvas@syr.edu %
% Part of Patch Antenna Design Code %
% August 2007 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Found=0;
if isempty(dir(filename))
return;
end
%Open the template file for reading.
[FID, MESSAGE] = fopen(filename,'r');
n=1;
while 1
tline = fgetl(FID); % read a single line
if ~ischar(tline), break, end % stop reading if the last line is read.
if ~isempty(strfind(tline,txt))
Found=1;
fclose(FID); % Close the file.
return;
end
end
fclose(FID); % Close the file.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?