How to find the maximum of each dimension in an array of matrix cells?

I am assigned an array of cells A, which consists of matrices of different sizes. For example, I could have an array of three elements, where are the sizes for each element:

A{1} -> 4 x 3
A{2} -> 16 x 4
A{3} -> 5 x 14

How do I go through an array of cells and return the maximum for each dimension as a whole? For example, the expected output of this operation with the example Aabove should give:

[16 14]

This is because, when examining the first dimension, the maximum number of rows over three matrices is 16. Similarly, the maximum number of columns over three matrices is 14.

0
source share
2 answers

. , , :

knedlsepp . :

[a(:,1),a(:,2)]=cellfun(@size,A);
max(a)
+4

, :

max(cell2mat(cellfun(@size,A(:),'uni',0)),[],1)
+3

All Articles