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:
Array Naming

Subject: Array Naming

From: Garrett

Date: 10 Mar, 2009 20:13:01

Message: 1 of 3

If you have an array manipulated by a For loop with index K is there a way to have the name of the final array be a string with K on the end. So essentially if the loop went through 3 times you would get

string1
string2
string3

in which each string would be equal to the array produced by the first, second and third cycles through the loop.

Thanks,

-Garrett

Subject: Array Naming

From: Walter Roberson

Date: 10 Mar, 2009 20:29:25

Message: 2 of 3

Garrett wrote:
> If you have an array manipulated by a For loop with index K is there a way to have the name
> of the final array be a string with K on the end

Yes.

The technical mechanism for doing this is best described by the standard sign
in physics labs:

   "Do not look directly into laser beam
    With remaining eye"

For more information, google for the Matlab FAQ.

Subject: Array Naming

From: Loren Shure

Date: 11 Mar, 2009 21:21:48

Message: 3 of 3

In article <gp6hkd$j6i$1@fred.mathworks.com>, bantong@onid.orst.edu
says...
> If you have an array manipulated by a For loop with index K is there a way to have the name of the final array be a string with K on the end. So essentially if the loop went through 3 times you would get
>
> string1
> string2
> string3
>
> in which each string would be equal to the array produced by the first, second and third cycles through the loop.
>
> Thanks,
>
> -Garrett
>

This is not a great idea:
http://matlabwiki.mathworks.com/MATLAB_FAQ#How_can_I_create_variables_A1
.2C_A2.2C....2CA10_in_a_loop.3F


--
Loren
http://blogs.mathworks.com/loren

Tags for 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