I have a structure that is organised something like this:
And I want to run a custom-written function on it.
Part of the function is to loop through all the elements in the structure:
I would also like this function to work on different, similarly organised data, e.g. Differentstructure(index).DataType.DataSubType.SDs. Thus I want to be able to give the overall name of the structure ('Subject') and the particular field ('DataType.DataSubType.means') as separate inputs to the function.
Is there a way to do this? I haven't been able to find one. Eval doesn't work, and I'm aware it isn't good practice anyway. If not, how should I organise my function to do this?