Generating a vector containing the sizes of all cells of a cell array, along a specific dimension
1 view (last 30 days)
Show older comments
Paolo Binetti
on 25 Jan 2017
Commented: Paolo Binetti
on 26 Jan 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.
Accepted Answer
the cyclist
on 25 Jan 2017
Edited: the cyclist
on 25 Jan 2017
Does this give what you want?
s = cellfun(@(x)size(x,1),a);
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!