Index is out of range when creating 3D arrray

1 visualización (últimos 30 días)
peek-a-boo
peek-a-boo el 19 de Oct. de 2021
Comentada: peek-a-boo el 19 de Oct. de 2021
This is a part of program code for reading csv file and creating 3D array.
But when runnig the code , the error "Index is out of range" occurs.
How is this code modified?
Providing supplementary information about this code, NUM_data = 40
list = dir(path);
list={list.name};
list = natsortfiles(list);
list = string(list);
for n = 1:length(NUM_data)
list(n);
X(:,:,n) = dlmread(list(n));
end
X_three_way = permute(X,[3 2 1]);
sample = X_three_way;

Respuestas (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 19 de Oct. de 2021
If NUM_data = 40, then your code should sth like this one:
...
for n = 1:NUM_data
X(:,:,n) = dlmread(list(n));
end
...
  1 comentario
peek-a-boo
peek-a-boo el 19 de Oct. de 2021
I tried your modification,
but the error "Index is out of range" occored.

Iniciar sesión para comentar.

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by