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:
saving data

Subject: saving data

From: taylor harry

Date: 30 Nov, 2011 19:43:09

Message: 1 of 2

Hey,
   I have an array called struct1 which is a 8302x2. I have another variable which is a character array w=bladder. I would like to rename my array (struct1) to be called bladder or the value of w. Thus my new array would be bladder which is now the 8302x2.

Subject: saving data

From: Jonathan

Date: 2 Dec, 2011 15:03:08

Message: 2 of 2

"taylor harry" wrote in message <jb610c$q88$1@newscl01ah.mathworks.com>...
> Hey,
> I have an array called struct1 which is a 8302x2. I have another variable which is a character array w=bladder. I would like to rename my array (struct1) to be called bladder or the value of w. Thus my new array would be bladder which is now the 8302x2.

There are two ways to do that.

% Assigns the value (struct1) to the variable (value of w) in the "caller" workspace
assignin('caller',w,struct1)

% Executes a string containing a matlab expression
eval(strcat(w,'=struct1'))

I'd personally go with the first option.

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