Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Can you add a "PREFIX" or "SUFFIX" or "EXTENSION" to all variables

Subject: Can you add a "PREFIX" or "SUFFIX" or "EXTENSION" to all variables

From: dpb

Date: 3 Dec, 2012 19:23:32

Message: 1 of 1

On 12/2/2012 10:27 PM, beginner1.mat@hotmail.com wrote:
> I would like to load several different mat files to make plots. Each
> mat file has the same format of variable names in them, but each mat
> file represents a different trial. Is there any way to add a "PREFIX" or
> "SUFFIX" or "EXTENSION" to all variables after being loaded? For
> example, when I load a mat file I will have 25 variables in my workspace:
...

> Is this possible?

It is, but you don't want to go down that road.

Use a structure name field for the various cases instead. See

<http://www.mathworks.com/help/matlab/matlab_prog/string-evaluation.html>

for background and suggestions of how to avoid the difficulties inherent
in making dynamic variable names (and, it's not the making that's the
problem; it's the using afterwards that's the pits).

--

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us