ZipFile

バージョン 1.04 (39.5 KB) 作成者: Collin Pecora
Extract individual zip archive entries from zip files from MATLAB
ダウンロード: 465
更新 2021/2/13

ZipFile is a MATLAB object that allows for extracting individual archive entries from zip files.

To create a ZipFile object;

zf = io.ZipFile('myfile.zip');

To open the user interface, call the constructor with no parameters

zf = io.ZipFile()

To extract specific entries;

zf.extract(whichEntry,whichDirectory);

Where whichEntry is the numeric index(s) or name of the entry to be extracted, for example;

zf.extract(':.ptx')

Will extract all entries that end with the extension '.ptx'. See the function getEntry.m in the @ZipFile folder for more whichEntry syntax. If the whichDirectory input is not supplied, the files will be extracted in the current directory.

ZipFile also provides the means to read zip entries and create variables directly in MATLAB without extracting the entry to disk. For example;

lr = zf.getLineReaderFor(10);

Creates a LineReader object for the 10th entry. LineReader objects read text files by lines, you would then write code to parse the lines into a MATLAB variable or object. Two other reader objects are provided, a DataReader for binary files and a TokenReader.

ZipFile can also read some image files directly to a MATLAB image matrix;

I = zf.readImage(whichEntry);

icons = zf.getAllImagesAsIcons();

Will read all images in the zip file and return a java array of ImageIcons.

If you just want to see the contents of a zip file, use the function zipdir.

listings = zipdir('myfile.zip');

Where listings is a structure array, similar to that returned by dir. If you do not supply an input to zipdir, a file selection dialog will be shown.

引用

Collin Pecora (2024). ZipFile (https://github.com/RocketWrench/ZipFile/releases/tag/1.04), GitHub. 取得済み .

MATLAB リリースの互換性
作成: R2018a
R2016b 以降のリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
タグ タグを追加
zip
謝辞

ヒントを与えたファイル: zipToolsPy

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
1.04

See release notes for this release on GitHub: https://github.com/RocketWrench/ZipFile/releases/tag/1.04

この GitHub アドオンでの問題を表示または報告するには、GitHub リポジトリにアクセスしてください。
この GitHub アドオンでの問題を表示または報告するには、GitHub リポジトリにアクセスしてください。