MATLAB Function Reference | ![]() ![]() |
Create compressed version of files in zip format
Syntax
Description
zip('zipfilename','files')
creates a zip file named zipfilename
from the file named files
. For multiple files, make files
a cell array of strings. Paths for zipfilename
and files
are relative to the current directory. Zip files are often used for archiving or for minimizing file transmission time.
zip('zipfilename','directory')
creates a zip file named zipfilename
consisting of the specified directory and all files in it. The paths for zipfilename
and directory
are relative to the current directory.
zip('zipfilename','source','rootdirectory')
allows the path specified for source
to be relative to 'rootdirectory'
rather than to the current directory. Note that source
cannot be an absolute path.
Zipping a File
Create a zip file of the file guide.viewlet
, which is in the demos
directory of MATLAB. It saves the zip file in d:/mymfiles/viewlet.zip
.
Zip the files guide.viewlet
and import.viewlet
and save the zip file in viewlets.zip
. The source files and zipped file are in the current directory.
Zipping a Directory
Zip the directory D:/mymfiles
and its contents to the zip file mymfiles
in the directory one level up from the current directory.
Zip the files thesis.doc
and defense.ppt
, which are located in d:/PhD
, to the zip file thesis.zip
in the current directory.
See Also
![]() | zeros | zoom | ![]() |