No BSD License  

Highlights from
CatOrSplitFile

Be the first to rate this file! 0 Downloads (last 30 days) File Size: 98.88 KB File ID: #8119
image thumbnail

CatOrSplitFile

by Michael Robbins

 

27 Jul 2005 (Updated 08 Sep 2005)

concatenates or splits files with an optional token header.

| Watch this File

File Information
Description

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

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
08 Sep 2005

Multiple changes + 2 new utilities:

WhichCatOrSplitFiles and RemoveCatOrSplitFilesHeader

Tag Activity for this File
Tag Applied By Date/Time
path Michael Robbins 22 Oct 2008 07:54:15
directories Michael Robbins 22 Oct 2008 07:54:15
files Michael Robbins 22 Oct 2008 07:54:15
varargin Michael Robbins 22 Oct 2008 07:54:15
cat Michael Robbins 22 Oct 2008 07:54:15
concatenate Michael Robbins 22 Oct 2008 07:54:15
append Michael Robbins 22 Oct 2008 07:54:15
add Michael Robbins 22 Oct 2008 07:54:15
split Michael Robbins 22 Oct 2008 07:54:15
divide Michael Robbins 22 Oct 2008 07:54:15
break up Michael Robbins 22 Oct 2008 07:54:15

Contact us at files@mathworks.com