help-octave
[Top][All Lists]
Advanced

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

append field to struct array


From: Eric Chassande-Mottin
Subject: append field to struct array
Date: Thu, 22 Jul 2010 07:57:34 -0700 (PDT)


hi Octavers,

is there a fast way to append a new field to an existing struct array

ie., something that would replace the for loop in the bottom code

octave3.2:1> a(1).a=0; a(2).a=1; a(3).a=2;
octave3.2:2> a
a =
{
  1x3 struct array containing the fields:

    a
}

octave3.2:3> b=[3,4,5];
octave3.2:4> for n=1:rows(a),a(n).b=b(n);endfor

when the array is large, the above is quite slow.

thanks, eric
-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/append-field-to-struct-array-tp2298806p2298806.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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