www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ZipAFolderExample.m

    %% Zip a Folder
% Zip the contents of all subfolders of a folder, and store the relative
% paths in the zip file.

%%
% Create a folder |myfolder| containing a subfolder |mysubfolder| and the
% files |membrane.m| and |logo.m|.
mkdir myfolder;
movefile('membrane.m','myfolder');
movefile('logo.m','myfolder');
cd myfolder;
mkdir mysubfolder;
cd ..

%%
% Zip the contents of all subfolders of |myfolder|.
zip('myfiles.zip','myfolder');