Error using gunzip function

8 views (last 30 days)
ASJ
ASJ on 13 May 2018
Commented: ASJ on 14 May 2018
Hi,
I have been using gunzip to process large quantities of data as shown below. I have about 100,000 files per year and 14 years to do.
This does exactly what I need - decompresses the .gz file and returns it to the original folder using exactly the same name but in .dat format.
files=gunzip('*.gz');
I have successfully (and very slowly) decompressed the first 7 years worth. However, I now keep getting the following error:
Error using gunzip>gunzipwrite (line 234)
Unexpected end of input stream when attempting to GUNZIP the file "metoffice-c-band-rain-radar_uk_201103071320_1km-composite.dat".
Error in gunzip>gunzipEntries (line 154)
names{k} = gunzipwrite(entries(k).file, outputDir, baseName, streamCopier);
Error in gunzip (line 90)
names = gunzipEntries(entries, outputDir);
Error in open2011 (line 1)
files=gunzip('*.gz');
Is there anything I can do to fix this error? When I restart the code, it decompresses the files that have already been decompressed and stops at the same error eventually.
Also, any suggestions in terms of speeding up the decompression process would be great. Also, it might be worth noting that I am using a mac.
Thanks in advance.
  6 Comments
Walter Roberson
Walter Roberson on 13 May 2018
I recommend using an external unzip instead of using gunzip(). gunzip() uses java methods and so is limited to java efficiency and has runs the risk of exceeding allocated java memory.
ASJ
ASJ on 14 May 2018
Thanks for your suggestions. The main issue that I have encountered with this is that due to the large number of files, the programs that I had a go running so far eventually crash.
The mac Utilities actually works pretty well and all you have to do is set it as the preferred program to open .gz files. And just by the process of trying to open a .gz file, it creates a .dat file next to the original one. However, you can only select about 500 files at a time (otherwise it crashes) so it is unfeasible to do this.
Is there a way I can work around this issue by perhaps using matlab to decompress using the utility software?

Sign in to comment.

Answers (0)

Categories

Find more on Data Import and Analysis in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!