Say I have some variables
var1 = 3;str2 = "MATLAB";syms x yeqn1 = x + y;
Say I want to get all the variables in this workspace with their respective values from within some function:
function listVars() allVarNames = evalin( 'base', 'who' ) allVarValues = ??? t = table(allVarnames, allVarValues)end
Is this possible? If not, is it possible if the variables are of the same type?
———————————————-
I already tried ??? =
evalin('base','allVarNames')%and
evalin('base',allVarNames)
But these result in these errors respectively:
Error using evalinUnrecognized function or variable 'allVarNames'.%andError using evalinMust be a text scalar.
Best Answer