How to combine two cell arrays as variables with changing sizes in a for loop for a fullfile command?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Tim K
el 13 de Jul. de 2022
Comentada: Tim K
el 13 de Jul. de 2022
Hi everyone,
i have two cell arrays:
H5 = 1x6 cell
A7 = 60x1 cell
Array Size changes over time but A7 is always 10x as big as H5.
The idea is that H5 contains file paths ends in a specific folder and A7 contains filenames in this specific folders.
In every folder from H5 are 10 files from A7.
The problem is an error message at the start of the second loop iteration:
"Unable to find or open 'C:\mypath\folder2(H5 position 2)\file1(A7 Position 1)'" so the loop doesnt work as i want.
Does anyone know how to get an F1 that take for every H5 Loop 10 A7 Loops?
Thank you!!
for uu = 1:size(H5,2)
for ii = 1:size(A7,1)
F1 = fullfile(H5{uu},A7{ii});
fprintf(1, 'Now reading %s\n', F1);
end
end
0 comentarios
Respuesta aceptada
Stephen23
el 13 de Jul. de 2022
for ii = 1:numel(A7)
jj = ceil(ii/10);
F1 = fullfile(H5{jj},A7{ii})
end
Más respuestas (0)
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!