Dear reader,
Here is a toy example. Inside a user-defined function, I currently use the following syntax:
a = evalin('base', 'a');b = evalin('base', 'b');c = evalin('base', 'c');
which allows me to load 3 matlab variables, called a,b,c from base environment into the current function's workspace. In reality I have many more variables, not only 3. Therefore, I am looking for a more elegant way to write this code.
A solution would be to write a new matlab function (I'll call it loadVarsFromBaseEnv.m) which should permit me to call it as follows:
loadVarsFromBaseEnv a b c
However, I have no idea how to write the code of loadVarsFromBaseEnv.m
Any help, suggestion are highly appreciated.
Best Answer