You can't use []
because the sizes of all tracks.matrix
are different, hence the concatenation fails.
You can however use {}
to concatenate to cell:
% example structure
t = struct(...
'matrix', cellfun(@(x)rand( randi([1 5])), cell(1, 30), 'uni', 0))
% find the maximum of all these data
M = max( cellfun(@(x)max(x(:)), {t.matrix}) );
Now, if you don't want to find the overall maximum, but the maximum per column (supposing you have (x,y,z) coordinates in each column, you should do
% example data
tracks = struct(...
'matrix', {rand(2,3) rand(4,3)})
% compute column-wise max
M = max( cat(1, tracks.matrix) )
This works because calling tracks.matrix
when tracks
is a multi-dimensional structure is equal to expanding the contents of a cell-array:
tracks.matrix % call without capture equates to:
C = {tracks.matrix}; % create cell
C{:} % expand cell contents