MATLAB: Storing the inputs of a function on a structure (or cell or array)

matlab function

given a function such as:
function [z,w] = tempFun(x,y)
z = x+1;
w = y+1;
end
is it possible to store a given pair x,y as a structure (struct('x',1,'y',2), say, or as a cell or anything else…) and then unpack it and apply the function to the output?
(In python this could be done as: temFun( **{'x':1, 'y':2})

Best Answer

d=struct('x',1,'y',2);
[z,w] = tempFun(d)
function [z,w] = tempFun(s)
z = s.x+1;
w = s.y+1;
end