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

4 views (last 30 days)
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

Accepted Answer

Rik
Rik on 19 Jul 2018
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.

More Answers (0)

Categories

Find more on Data Types in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!