[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Function in a Loop output problem

From: bpabbott
Subject: Re: Function in a Loop output problem
Date: Wed, 08 Sep 2010 14:48:51 +0000 (GMT)

On 08 Sep, 2010,at 10:42 AM, dirac <address@hidden> wrote:

Hi again everyone,

I have yet another problem that I have been stuck on for a few hours now: I
have a loop that calls a function whose output is two vectors.

for i=1:20

I want to use the data [a,b] once the loop has finished and the only way I
thought of this is to make a matrix whose columns are the vectors i.e add a
new column to two matrices wach time the loop goes around...if that makes
sense. a and b are equal in length but different for each iteration of the
loop if that makes sense...

Is there a way to do that? I thought of having two pre defined NaN matrix
with 20 columns so that I can replace each column with a and b each

Thanks in advance


I assume "a" and "b" are scalars?

a = b = zeros (1, 20);
for i = 1:20
  [a(i), b(i)] = function (variables);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]