Dynamic Variable Names in Matlab

Assume that you want to create a variable in Matlab whose name is contingent on factors that are unknown before the program runs.  For example, you may want to attach a time or date stamp to the end of a variable name.  You may also have variable names stored in a string or cell array that you want to instantiate as variables.  The best way to accomplish these tasks in Matlab is to use the eval function.  In the following examples, we’ll show you how to do these tasks.

Continue reading