How can I append to a vector in Octave?

The builtin functions are cat, vertcat, and horzcat, found on pages 380-381 of the Octave documentation (v 3.8). They are essentially equivalent to what you have though.

octave:5> A = [2 3 4];
octave:6> A = [A; 3 4 5]
A =

   2   3   4
   3   4   5

octave:7> B = [4 5 6];
octave:8> B = vertcat(B,[5 6 7])
B =

   4   5   6
   5   6   7

Another (again equivalent) way would be to directly use matrix indexing (see page 132)

octave:9> C = [6 7 8];
octave:10> C(end+1,:) = [7 8 9]
C =

   6   7   8
   7   8   9

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)