fappend.m
来自「一个研究声多普勒计程仪很好的工具箱」· M 代码 · 共 79 行
M
79 行
function theResult = fappend(varargin)% fappend -- Append files to an existing file.% fappend('outfile', 'infile_1', infile_2', ...)% appends the given input files to the output% file, creating it if necessary. Partial names% are resolved with the Matlab "which" command.% Note: the output file should not have the same% name as any input file. % Copyright (C) 2001 Dr. Charles R. Denham, ZYDECO.% All Rights Reserved.% Disclosure without explicit written consent from the% copyright owner does not constitute publication. % Version of 06-Aug-2001 14:18:38.% Updated 06-Aug-2001 14:55:12.CHUNK = 2048;if nargin < 1 help(mfilename) returnendw = which(varargin{1});if ~isempty(w) outfile = w;else outfile = varargin{1}; fout = fopen(outfile, 'a'); if fout < 0 disp([' ## Unable to create/open output-file: "' outfile '"']) return end outfile = fopen(fout); fclose(fout);endfor i = 2:length(varargin) infile = which(varargin{i}); if isequal(outfile, infile) disp(' ## Output-file must not have the same name as any input-file.') return elseif isempty(infile) disp([' ## No such input-file: "' varargin{i} '"']) return endendfout = fopen(outfile, 'a');if fout < 0 disp([' ## Unable to open output-file: "' outfile '"']) returnendfor i = 2:length(varargin) infile = which(varargin{i}); fin = fopen(infile, 'r'); if fin < 0 disp([' ## Unable to open output-file: "' infile '"']) fclose(fout) return end while (1) [s, count] = fread(fin, [1 CHUNK]); % Read characters. if count > 0 fwrite(fout, s); end if count < CHUNK fclose(fin); break; end endendfclose(fout);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?