MATLAB: How TABLE retreive the variable names

functioninput argumentvariable name

This example from the doc shows table is able to retrieve the variable names of the iput arguments list and uses them as column name:
LastName = {'Sanchez';'Johnson';'Li';'Diaz';'Brown'};
Age = [38;43;38;40;49];
Then
T = table(LastName,Age)
I get
T =
5×2 table
LastName Age
_________ ___
'Sanchez' 38
'Johnson' 43
'Li' 38
'Diaz' 40
'Brown' 49
For
T = table(LastName,Age+1)
I get
T =
5×2 table
LastName Var2
_________ ____
'Sanchez' 39
'Johnson' 44
'Li' 39
'Diaz' 41
'Brown'
My question is simple: how can do the same (retrieve the variable names) within my own function?
If yes, same question for output arguments:
bar = foo(123);
can foo retrieves 'bar'?