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 17 Dec, 2008 05:00:20
array george 17 Dec, 2008 05:00:20
matrix george 17 Dec, 2008 05:00:20
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