Upload every n file to matlab

1 visualización (últimos 30 días)
Hussein Kokash
Hussein Kokash el 18 de Jun. de 2021
Comentada: Hussein Kokash el 18 de Jun. de 2021
Hello all,
I have the following script that I use to upload text files to Matlab, I want to edit it so I can skip 10 files when uploading, i.e select the 1st file, skip 10 select the 2nd, etc. so I will end up with (1, 11, 21, 31) for example. is there a way that I can do that in Matlab?
Thank you, appreciate it.
[file_list, path_n] = uigetfile('.txt', 'Multiselect', 'on');
filesSorted = natsortfiles(file_list);
if iscell(filesSorted) == 0;
filesSorted = (filesSorted);
end
for i = 1:length(filesSorted);
filename = filesSorted{i};
data = load([path_n filename]);
x = data (:,1);
y = data (:,2);
end

Respuesta aceptada

KSSV
KSSV el 18 de Jun. de 2021
[file_list, path_n] = uigetfile('.txt', 'Multiselect', 'on');
filesSorted = natsortfiles(file_list);
if iscell(filesSorted) == 0;
filesSorted = (filesSorted);
end
for i = 1:10:length(filesSorted); %<-- change loop index here
filename = filesSorted{i};
data = load([path_n filename]);
x = data (:,1);
y = data (:,2);
end

Más respuestas (0)

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by