Unzipping using system command ? I couldn't understand the command

1 回表示 (過去 30 日間)
Reema Alhassan
Reema Alhassan 2018 年 7 月 19 日
回答済み: Rik 2018 年 7 月 19 日
someone wrote this and he said it was very helpful
sys_cmd_unzip = @(z,d) ['"C:\Program Files\7-Zip\7z.exe" e -y -r -o"' d '" "' z '" *'];
cellfun(@(z,d) system(sys_cmd_unzip(z,d)), all_zip_files, new_zip_file_dirs,'uniformoutput',false)
but the problem is that I couldn't understand this line:
@(z,d) ['"C:\Program Files\7-Zip\7z.exe" e -y -r -o"' d '" "' z '" *'];
what does this do '"C:\Program Files\7-Zip\7z.exe" e -y -r -o"' d '" "' z '" *' and what is z and d? can anyone help me with this please?
Thank you

採用された回答

Rik
Rik 2018 年 7 月 19 日
The cellfun function is used to apply a function each element of your cell array. By providing two cell arrays, the function is applied to each corresponding element.
In this case, the defined function takes in two inputs, where the first is named z and the second d. That means that z is the zip file name and d is the directory. The function then concatenates the several string parts, so it becomes a valid command.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by