Index a Matrix that gets smaller

1 visualización (últimos 30 días)
Bryson Prince
Bryson Prince el 11 de Abr. de 2021
Comentada: Bryson Prince el 11 de Abr. de 2021
I have a cell array that I am deleting any rows with empty values, and while indexing I run into the error:
"Index in position 1 exceeds array bounds (must not exceed 347)."
Here is the script for the part that has the issue, how can I index a cell array while deleting stuff as it goes?
for ind=2:size(RAW)
if sum(strcmp('',RAW(ind,4:7)))~=0
RAW(ind,:)=[]
end
end
note: I am skipping the first row intentionally, and also only checking columns 4 through 7

Respuesta aceptada

madhan ravi
madhan ravi el 11 de Abr. de 2021
for ind = size(RAW): -1 : 2
  1 comentario
Bryson Prince
Bryson Prince el 11 de Abr. de 2021
Replacing the for statement with that worked perfectly, thanks.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by