No BSD License  

Highlights from
File Split Append Utility

image thumbnail
from File Split Append Utility by Suresh Joel
Files for splitting and appending files.

mfappend(varargin)
function mfappend(varargin)

%Append multiple files to one file
%
%Usage
%       mfappend(varargin)
%  
%   Varargin is a cell array of the filenames.
%   All files (2nd to the last) are appended to the first file
%
%   Varargin can also be the filename of the file, which has been split using fsplit
%   This function will search and append all the files in the order in to the file 'filename'
%
%   SEE ALSO fsplit, fappend, uifappend
%
%Example:
%
%       USAGE 1:
%
%       fappend('1.img','2.img','3.img'); %Will append the '2.img' and '3.img' to '1.img'
%
%       USAGE 2:
%
%       fsplit('01.img',1.4); %Assuming that '01.img' is a file with 10MB
%       %The above command will split the file into 8 files 
%       %named '01.img1.spt','01.img2.spt',...,'01.img8.spt' each of 1.4MB size
%
%       %Move the spt files to another computer
%       
%       mfappend('01.img'); %Will join all the spt files to make 01.img
%       %if '01.img' already exists, it will be erased!

%Suresh E Joel, May 05, 2003

if length(varargin)==1,
    a=dir(strcat(char(varargin(1)),'*.spt'));
    if isempty(a), %If no spt files are found in that directory
        error(strcat('No -',char(varargin(1)),'*.spt files found'));
        return; 
    end;
    for i=1:size(a,1),
        varargin{i+1}=a(i).name;
    end;
    fid=fopen(char(varargin(1)),'w');
    fclose(fid);
end;

for i=2:length(varargin),
    fappend(char(varargin(1)),char(varargin(i)));
end;

Contact us at files@mathworks.com