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

3 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Entering Commands 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by