Create and Extract from Zip Archives
Create a Zip Archive
Create archives using zip files to back up files, conserve file storage space, or to share collections of files with others. You can either create an empty archive, or select files and folders to create an initial archive. In either case, you can add more files later.
Create zip archives interactively using the Current Folder browser:
To create an empty zip file, right-click white space, and then select New > Zip File.
To create a populated zip file from selected files and folders, select the folders and files you want to archive, right-click, and then select Create Zip File.
MATLAB® creates an archive with a default name of
n is an integer.
Type over the default file name to specify a descriptive name, for example
listmaster_export.zip, as shown here.
You also can create zip archives programmatically using the
zip function. For example, to zip all files with a
.mat extension in the current
folder to a zip file archive named
Add Files to a Zip Archive
To add files and folders to a zip file archive in the Current Folder browser, do one of the following:
Select, and then drag the file that you want to add onto the archive.
Copy the file that you want to add to the archive. Then, select the archive to which you want to add the file and paste the file into the archive.
Extract Files from a Zip Archive
To extract a single file from within a zip file archive in the Current Folder browser:
Expand the zip file archive to view the archive contents, by clicking the associated + (expand) button. By default, files within a zip file archive appear dimmed to indicate that they are not on the MATLAB path.
Drag the file into a folder in the Current Folder browser.
MATLAB extracts the file and saves it to the folder where you dragged or pasted it.
To extract all the contents of a zip file, double-click the zip file in the Current Folder browser. MATLAB creates a folder with the same name as the zip file, and extracts the entire contents of the zip file into this folder.
To extract the contents of a zip file programmatically, use the
unzip also allows you to specify a target folder. For
example, to unzip the file,
examples.zip, to a folder named
Archives created outside of MATLAB can be encrypted or password-protected. You cannot add files to, or extract files from, protected archives from within MATLAB.
Compare Zip Archive to Unzipped Files
To determine differences between archived and unarchived files, use the Comparison Tool from within the Current Folder browser as you would for any other files and folders.
Right-click a zip archive, and then from the context menu select Compare Against and specify the folder to which you want to compare the contents of the zip archive.
Expand a zip archive, right-click a file within it, and then from the context menu select Compare Against. Specify the file to which you want to compare the archived file.