Thread Subject: Problem with a loop!!!

Subject: Problem with a loop!!!

From: george

Date: 17 Dec, 2008 09:56:03

Message: 1 of 2

Hello,
..So,i have a loop,
and i want to make an array with the same columns,but i want to increased the rows in every loop.
for example i have this:

for k=1:15
    qw[k][7]=[r_Ti(1,2),r_Te(1,2),r_F(1,2),r_Vt(1,2),r_Vi(1,2),r_Vei(1,2),r_Vee(1,2)];
end



is this correct?

And i want in the end of this loop one array with 15 rows and 7 colums..How can i get this?



ps"the values of r_Ti(1,2) etc. in every loop are different"


Thanks for your attention!!


I hope that you understand .because i don't now good english...

Subject: Problem with a loop!!!

From: Sebastiaan

Date: 17 Dec, 2008 10:31:03

Message: 2 of 2

Well, there are basically 2 options: make a normal matrix with 0's or NaN's, or use the cell functions:

B = zeors(15, 7);
B(:) = NaN;
B(1,1) = [1];
B(1,1:2) = [1 2];
B(1,1:3) = [1 2 3];

-or-

A = cell(15, 1);
A{1} = [1];
A{2} = [1 2];
A{3} = [1 2 3];

Greetz,

"george " <qwerty6542@yahoo.gr> wrote in message <giaibj$6q$1@fred.mathworks.com>...
> Hello,
> ..So,i have a loop,
> and i want to make an array with the same columns,but i want to increased the rows in every loop.
> for example i have this:
>
> for k=1:15
> qw[k][7]=[r_Ti(1,2),r_Te(1,2),r_F(1,2),r_Vt(1,2),r_Vi(1,2),r_Vei(1,2),r_Vee(1,2)];
> end
>
>
>
> is this correct?
>
> And i want in the end of this loop one array with 15 rows and 7 colums..How can i get this?
>
>
>
> ps"the values of r_Ti(1,2) etc. in every loop are different"
>
>
> Thanks for your attention!!
>
>
> I hope that you understand .because i don't now good english...

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
loop george ts 17 Dec, 2008 05:00:20
array george ts 17 Dec, 2008 05:00:20
matrix george ts 17 Dec, 2008 05:00:20
rssFeed for this Thread

Contact us at files@mathworks.com