Documentation Center

  • Trial Software
  • Product Updates


Uncompress GNU zip files


gunzip(url, ...)
filenames = gunzip(...)


gunzip(files) uncompresses GNU zip files from the list of files specified in files. Directories recursively gunzip all of their content. The output files have the same name, excluding the extension .gz, and are written to the same directory as the input files.

files is a string or cell array of strings containing a list of files or directories. Individual files that are on the MATLAB® path can be specified as partial path names. Otherwise, an individual file can be specified relative to the current directory or with an absolute path.

Folders must be specified relative to the current folder or with absolute paths. On UNIX® systems, folders can also start with ~/ or ~username/, which expands to the current user's home folder or the specified user's home folder, respectively. The wildcard character * can be used when specifying files or folders, except when relying on the MATLAB path to resolve a file name or partial path name.

gunzip(files,outputdir) writes the gunzipped file into the directory outputdir. If outputdir does not exist, MATLAB creates it.

gunzip(url, ...) extracts the GNU zip contents from an Internet universal resource locator (URL). The URL must include the protocol type (for example, 'http://'). MATLAB downloads the URL to the temp directory, and then deletes it.

filenames = gunzip(...) gunzips the files and returns the relative path names of the gunzipped files in the string cell array filenames.


To gunzip all .gz files in the current directory, type:


To gunzip Cleve Moler's "Numerical Computing with MATLAB" examples to the output directory ncm, type:

url ='';

See Also

| | | |

Was this topic helpful?