Fail to unzip .gz file using 7zip in Matlab
조회 수: 6 (최근 30일)
이전 댓글 표시
Hello,
I have a folder that has multiple gz files and I'd like to unzip the selected file from the folder to unzip. I first select the file and save it under gz_full_path. I havea destination folder called session_folder_path where the extracted file needs to be saved.
The 7 zip exe is already in the path.
When I run the code below, it returns an error 'COMMAND must be a string scalar or character vector'.
When I run the alternate version to extract using 7zip, it retrns an error 'Incorrect command line'.
Any pointers on what is wrong would help. it was working couple of hours ago but it is failing to run now. Unsure why
[gz_file, gz_path] = uigetfile('*.gz', 'Select the session output file', session_folder_path);
gz_full_path = strcat(gz_path, gz_file);
[status,output] = system(['"C:\Program Files\7-zip\7za920\7za.exe" -y x ' '"' gz_full_path '"' ' -o' '"' session_folder_path '"']);
if status
error("There was an error running your command: %s", output);
return;
end
%%%
%Alternate version
unzip_cmd = "7za e" + gz_full_path + " -o" + session_folder_path + "\files -y";
[status,output] = system(unzip_cmd);
if status
error("There was an error running your command: %s", output);
return;
end
댓글 수: 0
답변 (1개)
Star Strider
2022년 11월 1일
댓글 수: 2
Star Strider
2022년 11월 1일
My pleasure!
That would be difficult, since I don’t know how you set up your system. I’m also not familiar with 7zip.
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!