Code wont extract from file

Hi everyone,
Thanks for the help in advance...
My code wont find my file from its path and I cant find why. Im trying to create a loop which goes over a range of .csv files within their .zip folders within the location 'x' which I have hid. so it would be like x\1.zip\1.csv for the first loop, x\2.zip\2.csv for the second loop. my 'x' is copy and pasted straight from the finder.
clc;
clear all;
close all;
location = 'x'; % Set files location
combinedTable = [];
for i = 2017:2017
for j = 1:12
for k = 1:31
for l = 1:24
for m = 0:5
file = sprintf('PRT%d%02d%02d%02d%d000.zip', i, j, k, l, m);
dataFile = sprintf('%s.csv', file(1:end-4));
filePath = fullfile(location, file)
if exist(filePath, 'file') == 2
% File exists
T = readtable(filePath);
T = table2cell(T);
% Remove the first row of the table
T(1, :) = [];
% Concatenate the current table with the combined table
combinedTable = [combinedTable; T];
end
end
end
end
end
end
disp(combinedTable);

回答(1 个)

Use unzip() while reading your data files, since your files are achived.

2 个评论

Is there a way I can do this without unzipping as its hundreds of thousands of files?
Also, permission is denied to do this (altough I do have access to the folder I think its read only)

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Downloads 的更多信息

产品

版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by