MATLAB: How to get the min/max value of all fields in a stucture

structures

I would like to obtain the minimum and maximum value in my structure which contains multiple fields.
structure_1.field_01
structure_1.field_02
structure_1.field_03
structure_1.field_04
I require something like-
min_val = min(struct.(:));
Is this possible using one function?
thanks in advance,
Marcus

Best Answer

out = min(structfun(@(x)min(x(:)),structure_1));