This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Extract contents of zip file


filenames = unzip(___)



unzip(zipfilename) extracts the archived contents of zipfilename into the current folder, preserving the attributes and timestamps of each file. unzip can extract files from your local system or from an Internet URL.

If a file exists with the same name and the file is not read-only, MATLAB® overwrites it. Otherwise, MATLAB issues a warning. On Microsoft® Windows® platforms, the hidden, system, and archive attributes are not set.


unzip(zipfilename,outputfolder) extracts zipfilename into outputfolder. If outputfolder does not exist, MATLAB creates it.


filenames = unzip(___) returns a cell array of character vectors containing the names of the extracted files.


collapse all

Create a zip file and extract it to the folder archive.

Create the zip file containing example MAT-files.


Extract to the folder archive.

exampleFiles = unzip('examples','archive')
exampleFiles = 1x40 cell array
  Columns 1 through 3

    {'archive/accide...'}    {'archive/airfoi...'}    {'archive/airlin...'}

  Columns 4 through 6

    {'archive/cape.mat'}    {'archive/census...'}    {'archive/clown.mat'}

  Columns 7 through 9

    {'archive/detail...'}    {'archive/dmbann...'}    {'archive/durer.mat'}

  Columns 10 through 12

    {'archive/earth.mat'}    {'archive/fatali...'}    {'archive/fluidt...'}

  Columns 13 through 15

    {'archive/flujet...'}    {'archive/gatlin...'}    {'archive/gatlin...'}

  Columns 16 through 18

    {'archive/intege...'}    {'archive/logo.mat'}    {'archive/mandri...'}

  Columns 19 through 21

    {'archive/mapred...'}    {'archive/membra...'}    {'archive/mri.mat'}

  Columns 22 through 24

    {'archive/patien...'}    {'archive/penny.mat'}    {'archive/quake.mat'}

  Columns 25 through 27

    {'archive/seamou...'}    {'archive/spine.mat'}    {'archive/stocks...'}

  Columns 28 through 30

    {'archive/tetmes...'}    {'archive/topo.mat'}    {'archive/topogr...'}

  Columns 31 through 33

    {'archive/trimes...'}    {'archive/trimes...'}    {'archive/truss.mat'}

  Columns 34 through 36

    {'archive/usapol...'}    {'archive/usasta...'}    {'archive/usbord...'}

  Columns 37 through 39

    {'archive/vibesd...'}    {'archive/west04...'}    {'archive/wind.mat'}

  Column 40


Download and extract a zip file from a URL to a local folder.

Suppose you have the zip file stored at the URL Download and extract the file to the example folder.

url = '';

Input Arguments

collapse all

Name of zip file to extract from, specified as a character vector or a string scalar. If zipfilename has no extension, MATLAB searches for zipfilename appended with .zip.

zipfilename must include a path relative to the current folder or an absolute path.

If zipfilename is a URL, zipfilename must include the protocol type (for example, http://). MATLAB downloads the URL to the temporary folder on your system, and then it deletes the URL on cleanup.

unzip does not support password-protected or encrypted zip archives.

Data Types: char | string

Target folder for the extracted files, specified as a character vector or a string scalar.

Data Types: char | string


  • To extract a zip file that contains non-7-bit ASCII characters, extract the file on a machine that has the appropriate language/encoding settings.

Introduced before R2006a