Generating a vector containing the sizes of all cells of a cell array, along a specific dimension
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Paolo Binetti
el 25 de En. de 2017
Comentada: Paolo Binetti
el 26 de En. de 2017
Is there a way to vectorize this? (I tried with "cellfun", but did not succeed).
for i = 1:numel(a)
s(i) = size(a{i}, 1);
end
Where a sample of "a" is provided in attachment.
2 comentarios
the cyclist
el 25 de En. de 2017
Editada: the cyclist
el 25 de En. de 2017
It would be much easier to help if you posted code that actually creates a small example of a, rather than pseudocode that illustrates what you mean.
Is
AGA
AGA
meant to represent a 2x3 character array? So, is it correct that
a{1,1} = ['AGA';'AGA'];
would be an example of one element? It seems like that's what you mean, but wanted to be sure.
Respuesta aceptada
the cyclist
el 25 de En. de 2017
Editada: the cyclist
el 25 de En. de 2017
Does this give what you want?
s = cellfun(@(x)size(x,1),a);
Más respuestas (1)
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices 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!