我想在不使用Matlab解压缩的情况下读取zip文件中的文本文件
Read the data of CSV file inside Zip File without extracting the contents in Matlab
上面的建议正在工作,我得到了文件的单元格列表。
zipFilename = 'C:\ZippedData.zip';
zipJavaFile = java.io.File(zipFilename);
% Create a Java ZipFile
zipFile = org.apache.tools.zip.ZipFile(zipJavaFile);
% Extract the entries from the ZipFile.
entries = zipFile.getEntries;
cnt = 1;
% Get Zip File Paths
while entries.hasMoreElements
tempObj = entries.nextElement;
file{cnt,1} = tempObj.getName.toCharArray';
cnt = cnt+ 1;
end
% Extract File Name
ind = regexp(file,'textfile.*');
ind = find(~cellfun(@isempty,ind)); % Find Non Empty Cell Index
file = file(ind);
% Create Absolute Path so that Windows consider as Directory
file = cellfun(@(x) fullfile('.',x),file,'UniformOutput',false);
\ file1,。\ file2,...,。\ filen,但是他们如何在fopen中使用它并说textscan?类似于fileID = fopen([zipFilename filesep file {1}]); ?。