Borrar filtros
Borrar filtros

Number of elements in cell array

9 visualizaciones (últimos 30 días)
Ishan Gawai
Ishan Gawai el 12 de Mzo. de 2021
Comentada: Ishan Gawai el 13 de Mzo. de 2021
Consider following code and I want find total number of elements in a. I want the answer to be 17.
a = {2};
a(2) = {magic(4)};
  1 comentario
Mathieu NOE
Mathieu NOE el 12 de Mzo. de 2021
yes
total number of a array is 17
a{:}
ans =
2
ans =
16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1

Iniciar sesión para comentar.

Respuesta aceptada

Balazs Fischer
Balazs Fischer el 12 de Mzo. de 2021
sum(cellfun('prodofsize',a))
it gets more complicated when a contains other cell arrays.

Más respuestas (0)

Categorías

Más información sobre Data Types 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!

Translated by