help-octave
[Top][All Lists]
Advanced

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

Re: Joining arrays


From: Judd Storrs
Subject: Re: Joining arrays
Date: Tue, 23 Jun 2009 20:19:34 -0400

I think should [ A B ] work.

octave:1> A = [ 1 2 3 ; 4 5 6 ; 7 8 9 ]
A =

   1   2   3
   4   5   6
   7   8   9

octave:2> B = [ 10 11 12 ; 13 14 15 ; 16 17 18 ]
B =

   10   11   12
   13   14   15
   16   17   18

octave:3> [ A B ]
ans =

    1    2    3   10   11   12
    4    5    6   13   14   15
    7    8    9   16   17   18



--judd

On Tue, Jun 23, 2009 at 8:14 PM, CLOSE Dave <address@hidden> wrote:
I started working with Octave only about a month ago but I'm still
confused. I can't seem to find the right way to do something which ought
to be pretty simple. I want to join two arrays to make a bigger array.
That is, given arrays A and B like,

 A = a b c       B = 1 2 3
     d e f           4 5 6
     g h i           7 8 9

I want to create array C like,

 C = a b c 1 2 3
     d e f 4 5 6
     g h i 7 8 9

(I'm using letters to stand for numbers, not as strings. It's just to
keep my example to single characters.)

What I keep getting is an array of arrays,

 C(1) = a b c     C(2) = 1 2 3
        d e f            4 5 6
        g h i            7 8 9

What simple operation am I missing?


_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave


reply via email to

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