CatOrSplitFile

버전 1.0.0.0 (98.9 KB) 작성자: Michael Robbins
concatenates or splits files with an optional token header.
다운로드 수: 1.9K
업데이트 날짜: 2005/9/8

라이선스 없음

CATORSPLITFILES concatenates or splits files with an optional token header.

CATORSPLITFILES('CAT',FILENAME,TARGETFILENAME,param,value, ...)
FILENAMES = CATORSPLITFILES('SPLIT',TARGETFILENAME,param,value, ...)

CAT (concatenate) PARAMETERS, VALUES AND DEFAULTS
Parameter Values Defaults
--------- ---------------- --------
HEADER 'OFF','%','NO%' '%'
SILENT 'OFF','ON' 'OFF'
PROP 'OFF','ON' 'OFF'

If HEADER is % (default) each file that is combined will be titled with a
comment that begins with % and is easily recognisible. If you should
desire to split the file up again, CATORSPLITFILES can use this comment
to do it properly.

If HEADER is NO%, the action is very similar to the default action except
the comment does not begin with %.

If HEADER is OFF, then all the files are combined into one large one. If
this is done it may not be reversible since the only way to split them
again is with the FUN feature.

If SILENT is ON, the CATORSPLITFILE will not prompt the user before
overwriting a file.

The PROP feature is proprietary and not available to the public.

which may not split the file where it was originally since it will split
on the function definitions. If one of the original files had more than
one function definition or if one of the original files

SPLIT PARAMETERS, VALUES AND DEFAULTS
Parameter Values Defaults
--------- ---------------- --------
HEADER '%','NO%','FUN' '%'
SILENT 'OFF','ON' 'OFF'
BACKUP 'OFF','ON' 'ON'
SPLITTO string where it came from

If HEADER is % (default) the file will be split on a comment produced
with CATORSPLITFILES that begins with % and is easily recognisible.

If HEADER is NO%, the action is very similar to the default action except
the comment does not begin with %.

If HEADER is FUN, then CATORSPLITFILE will split on function definitions
putting each function in a different m-file.

If SILENT is ON, the CATORSPLITFILE will not prompt the user before
overwriting a file.

If BACKUP is ON (default), CATORSPLITFILE will not backup files before
overwriting them. The backed up file will have the same name, but will
have the .bak extension.

If SPLITTO is not specified, then the file will split to the location
from where it was combined. For example, if you combined c:\ml\file1 and
c:\ml\file2 to bigfile, bigfile will be split back into c:\ml\file1 and
c:\ml\file2. But if you specify SPLITTO to be c:\temp, then bigfile will
be split into c:\temp\file1 and c:\temp\file2.

CATORSPLITFILE will return the names of the files that are produced when
splitting

Example
% Combine all the files in the working directory into one
CatOrSplitFiles('cat','ConcatenateFilesTest','tst.m','header','no%');
% Display the combined file
type cattest
% Split it back up to reverse the process
filenames = CatOrSplitFiles('split','cattest.m', ...
'backup','on','header','no%','splitto',pwd);
% Look at the directory to see that the backup files have been made
dir

Uses
ParseVarargin

Used by
SearchReplaceManyGUI

keywords
varargin cat concatenate append add split divide break up combine file header

See also: ParseVarargin SearchReplaceManyGUI



It's not fancy, but it works

인용 양식

Michael Robbins (2024). CatOrSplitFile (https://www.mathworks.com/matlabcentral/fileexchange/8119-catorsplitfile), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R14
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0

Multiple changes + 2 new utilities:

WhichCatOrSplitFiles and RemoveCatOrSplitFilesHeader