I am trying to design a wrapper function that takes a function-handle as input as well as a Struct that contains the function's arguments and a reference struct, that contains the desired number of outputs for the function and the fiedldnames, that they should be stored under in a return struct. Something like this:
Is there any way to "resolve" the Struct-Fields of InputData and use them as input-arguments for funcHandle, when the number of fields/input arguments may vary?
function TestStruct = callFunctionUnderTest(funcHandle, InputData, OutputData)
TestStruct = ;
if nargout(funcHandle) ~= length(fieldnames(OutputData))
[TestStruct.(ouput1), TestStruct.(output2), TestStruct.(output3)] = funcHandle(InputData.funcarg1, InputData.funcarg2)