FUNCTION REFERENCE

zip

Compress files into a ZIP archive.

Compress files into a ZIP archive.

Syntax

zip(zipfilename, files)

Syntax

entrynames = zip(zipfilename, files, rootfolder)

files is a name or a cell array of names; folders are added recursively and * or ? wildcards match in the last name part. Names are relative to rootfolder (default: the current folder) and stored with / separators. '.zip' is appended when the name has another extension. Entries use Deflate compression.

Example

d=tempname(pwd); mkdir(d); fid=fopen(fullfile(d,'a.txt'),'w'); fprintf(fid,'hi'); fclose(fid); names=zip(fullfile(d,'a.zip'),'a.txt',d); rmdir(d,'s'); names{1}   % a.txt

Differences from MATLAB: A file given by an absolute path outside the root folder is stored under its own name only. Folder entries are not stored; at most 10000 files and 256 MiB in total.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.