Borrar filtros
Borrar filtros

question on cell array

2 visualizaciones (últimos 30 días)
jana
jana el 10 de Sept. de 2013
I have the following cell arrays:
K{1} = [0,1,2,4]
K{2} = [3,6,7]
K{3} = [0,3,7]
I want to check if my cell array has a zero and get rid of that zero. My cell array is sorted so if there is a zero, it will be in the first indice. please help.

Respuesta aceptada

the cyclist
the cyclist el 10 de Sept. de 2013
K = cellfun(@(x)x(x~=0),K,'UniformOutput',false)

Más respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 10 de Sept. de 2013
for k=1:numel(K)
if K{k}(1)==0
K{k}=K{k}(2:end);
end
end

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by