Matlab fields function. However, I would like a function that determi.