Code get stuck after "gunzip" command

1 view (last 30 days)
Katy Weihrich
Katy Weihrich on 26 Feb 2018
Answered: Katy Weihrich on 26 Feb 2018
I need to extract some ziped data and I wrote a Matlab loop to extract them, however, my code gets stuck every time after a file is unzipped and I need to terminate it.
Since the names of the files (readings.csv.gz-00001-of-00020, readings.csv.gz-00002-of-00020, ...) have this "-00001-of-00020" ending that gets deleted, I also have to rename the unzipped file every time and cannot just unzip the whole folder at ones, since the data would overwrite itself then.
I have:
Components_FileName = '-00001-of-00020'
DATA_Extraction = ['C:\Projects\...\readings.csv.gz' Components_FileName];
FILENAME_OutputPathway = 'C:\Projects\...\extracted\';
UnzipedData = gunzip(DATA_Extraction, FILENAME_OutputPathway)
oldname = UnzipedData;
newname = [FILENAME_OutputPathway 'Unzipeddata_' Components_FileName]
movefile(oldname, newname)
Does someone know what goes wrong? Gunzip seems to be executed well, since I do have the data, in the end, but the code does not continue afterwards.
And when I cancel the command I get this output:
Operation terminated by user during gunzip>gunzipwrite (line 228)
In gunzip>gunzipEntries (line 151) names{k} = gunzipwrite(entries(k).file, outputDir, baseName, streamCopier);
In gunzip (line 87) names = gunzipEntries(entries, outputDir);
In OpenFile (line 87) gunzip(DATA_Extraction, FILENAME_OutputPathway)

Answers (1)

Katy Weihrich
Katy Weihrich on 26 Feb 2018
I am sorry, I realised that the reason the code did not continue was, that the file was not done unzipping, through you were already able to see the already zipped data when terminating and opening the document


Find more on File Compression 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!