MATLAB: Load all fields of a struct as input into a function

struct fields input function

Hello! I´m new in Matlab. I'm searching for an easy way to load all the fields of a struct as input into a function.
What i want to do:
Function:
function [Var3] = TestFunction(Input)
Var3=Var1*Var2;
end
Script:
Input.Var1=5;
Input.Var2=6;
[Var3] = TestFunktion(Input);
Error: Undefined function or variable 'Var1'.
Workaround would be:
Function:
function [Var3] = TestFunction(Var1 Var2)
Var3=Var1*Var2;
end
Script:
Input.Var1=5;
Input.Var2=6;
[Var3] = TestFunktion(Input.Var1 Input.Var2);
But imagine if you have like 100 fields inside the Input-struct and you need all of them as input for your function, it would take a long time to write down all the Input-fields separately.
I will greatly appreciate any assistance.

Best Answer

If your structure Input always has fields Var1 and Var2, a simple solution would be like this.
function Var3 = TestFunction(Input)
Var3 = Input.Var1*Input.Var2;
end