help-octave
[Top][All Lists]
Advanced

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

Appending to a vector in a cell array


From: Søren Hauberg
Subject: Appending to a vector in a cell array
Date: Tue, 14 Jun 2005 16:17:14 +0200
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050404)

Hi
In a C++ file I have a Cell array containing vectors to which I sometimes have to append values. To this I do the following:

RowVector tmp = out(r,c).row_vector_value();
tmp.resize_and_fill(1,tmp.length()+1, my_value); // append
out(r,c) = tmp;

Is there an easier way to accomplish this?
Also could the code above create a memory leak? After I added these lines to my program it runs out of memory and breaks. It might not be related, but I thought I'd ask...

/Søren



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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