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);

Réponses (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov le 28 Juin 2023

0 votes

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

2 commentaires

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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Produits

Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by