Finding total count of values in a cell array?
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
I have a 4-D cell array, and there are empty arrays '[]' within it. How do I find the total number of the empty arrays?
This is what I tried.
% A is 4-D cell array
cnt = 0;
for a = 1:1:(size(A, 1))
    for b = 1:1:(size(A, 2))
        for c = 1:1:(size(A, 3))
            for d = 1:1:(size(A, 4))
                if A(a, b, c, d) == [] 
                    then cnt = cnt + 1;
                end
            end
        end
    end
end
Error: Undefined function or method 'eq' for input arguments of type 'cell'.
Someone please help me? Thanks.
4 comentarios
  Fangjun Jiang
      
      
 el 13 de Ag. de 2011
				First, to reference the content of a cell array, you need to use {}, not ()
To check if the content is empty, use isempty(), not to use ==[]
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
				Más información sobre Logical 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!

