You can use the min function in MATLAB to extract the smallest value from a mixed structure. Here is an example:
main.m195 chars8 lines
Note that we combine field1 and field3 into a single array using square brackets before passing to the min function. This is necessary because min only works with arrays and not mixed structures. In this case, smallest will be equal to the smallest value in [5 7 9 3.14159], which is 3.14159.
If your mixed structure contains non-numeric values, such as character arrays or cell arrays, then the min function will return an error. In that case, you will need to preprocess the data to remove non-numeric values or use a custom function.
gistlibby LogSnag