Thread Subject: matrix names

Subject: matrix names

From: Nirmal

Date: 30 Aug, 2009 21:34:03

Message: 1 of 4

how to assign different names for matrices in a for loop..

for ex

if x=[1 2]

if i want I1=[1 1]
           I2= [1 2]

for i=1:2
     [what must be here??]=[1 x(i)];
end;

since i cant write Ii or I(i) m confused how to assign names in a for loop..

thank u..

Subject: matrix names

From: arun

Date: 30 Aug, 2009 21:40:49

Message: 2 of 4

On Aug 30, 11:34 pm, "Nirmal " <nirmal_2...@yahoo.co.in> wrote:
> how to assign different names for matrices in a for loop..
>
> for ex
>
> if x=[1 2]
>
> if i want I1=[1 1]
>            I2= [1 2]
>
> for i=1:2
>      [what must be here??]=[1   x(i)];
> end;
>
> since i cant write Ii or I(i) m confused how to assign names in a for loop..
>
> thank u..

use a(i,:) to fill in the whole row with a vector and a(:,i) to fill a
column...

ex: a(1,:) = [1,2]; a(2,:) = [2,2];
if not, a(:,1) = [1;2]; a(:,2)= [2;2];

notice the ',' and ';' separators between row and column assignment
operations.
best, arun.

Subject: matrix names

From: us

Date: 30 Aug, 2009 21:44:04

Message: 3 of 4

"Nirmal " <nirmal_2489@yahoo.co.in> wrote in message <h7er8b$pjg$1@fred.mathworks.com>...
> how to assign different names for matrices in a for loop..

you are absolutely NOT allowed to do this in ML...
otherwise,
1) your license will be revoked by a bot...
2) your computer will be incinerated by law-of-CSSM...

http://matlabwiki.mathworks.com/MATLAB_FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F

us

Subject: matrix names

From: Matt Fig

Date: 31 Aug, 2009 00:30:17

Message: 4 of 4

"us " <us@neurol.unizh.ch> wrote in message <h7err4$bpq$1@fred.mathworks.com>...
> "Nirmal " <nirmal_2489@yahoo.co.in> wrote in message <h7er8b$pjg$1@fred.mathworks.com>...
> > how to assign different names for matrices in a for loop..
>
> you are absolutely NOT allowed to do this in ML...
> otherwise,
> 1) your license will be revoked by a bot...
> 2) your computer will be incinerated by law-of-CSSM...
>
> http://matlabwiki.mathworks.com/MATLAB_FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F
>
> us


You left out the drunken gremlins which come by night.
They will be named gremlin_1, gremlin_2, gremlin_3, ...

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
faq_4point6 Matt Fig 30 Aug, 2009 20:27:34
faq us 30 Aug, 2009 17:59:27
reference us 30 Aug, 2009 17:59:26
matrix Nirmal 30 Aug, 2009 17:39:01
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com