Extracting specific file from zip in matlab -
currently have zipfile containing several thousand .xml files, extracted folder 1.5gb in size. have function matches data specific files inside zip file. want read specific file , extract additional data.
my question: there way extract these specific files archive without unzipping entire archive?
the built in unzip.m function can used unzip entire file won't work thinking have use com interface or other approach.
matlab version: r2013a
while searching solutions found this:read data of csv file inside zip file without extracting contents in matlab
but can't code in answer work situation
edit:
credit hoki , intelk
zipfilename = 'hmdb.zip'; zipjavafile = java.io.file(zipfilename); zipfile=org.apache.tools.zip.zipfile(zipjavafile); entries=zipfile.getentries; cnt=1; while entries.hasmoreelements tempobj=entries.nextelement; file{cnt,1}=tempobj.getname.tochararray'; cnt=cnt+1; end ind=regexp(file,'$*.xml$'); ind=find(~cellfun(@isempty,ind)); file=file(ind); file = cellfun(@(x) fullfile('.',x),file,'uniformoutput',false);
and not forgetting
zipfile.close
Comments
Post a Comment