Loop for Concatenating files *.CSV

1 visualización (últimos 30 días)
Abdul Hannan Qureshi
Abdul Hannan Qureshi el 12 de Mzo. de 2024
Editada: Stephen23 el 13 de Mzo. de 2024
Hello,
How can I develop a loop for this script.
Folder.mat contains 10 *.CSV files data.
Folder;
V=vertcat(Folder{10, 1},Folder{9,1},Folder{8, 1},Folder{7,1},Folder{6, 1},Folder{5,1},Folder{4, 1},Folder{3,1},Folder{2, 1},Folder{1,1});
Need assistance please. Regards

Respuesta aceptada

Stephen23
Stephen23 el 12 de Mzo. de 2024
Editada: Stephen23 el 12 de Mzo. de 2024
  3 comentarios
Abdul Hannan Qureshi
Abdul Hannan Qureshi el 13 de Mzo. de 2024
Editada: Abdul Hannan Qureshi el 13 de Mzo. de 2024
Thanks for hint and guidance, I have modified it and it working perfectly.
for ii = 1:N
dataH = vertcat(iwant{N:-1:1});
end
Kindly what -1:1 represents ?
Rest query has been resolved. Thanks.
Stephen23
Stephen23 el 13 de Mzo. de 2024
Editada: Stephen23 el 13 de Mzo. de 2024
"Kindly what -1:1 represents ? "
The colon operator creates a vector of values (which are then used as indices into IWANT):
10:-1:1
ans = 1×10
10 9 8 7 6 5 4 3 2 1
Your FOR-loop seems to be superfluous. In any case, the code I showed you does not require a FOR-loop to replicate that which you showed in your original question or in your comment.

Iniciar sesión para comentar.

Más respuestas (1)

Alexander
Alexander el 12 de Mzo. de 2024
Editada: Alexander el 12 de Mzo. de 2024
I'm really not sure if I understood you correctly, but this might be what you want:
load Folder
for ii = 1:10
dy = iwant{ii}(1:512,1:end);
y(:,:,ii) = dy;
end
  2 comentarios
Alexander
Alexander el 12 de Mzo. de 2024
I've just a line added to check the data at once:
load Folder
for ii = 1:10
dy = iwant{ii}(1:512,1:end);
y(:,:,ii) = dy;
mesh(y(:,:,ii)); drawnow; title(num2str(ii)); drawnow; pause; % to check the data
end
Abdul Hannan Qureshi
Abdul Hannan Qureshi el 13 de Mzo. de 2024
@Alexander, thanks for response. I am sorry if query was not clear. Thanks for your effort.

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by