Supposing that you have two matrices A and B as shown by Judd.
Then
to concatenate them horizontally do this
C=[A B]
to concatenate them vertically do this
C=[A;B]
regards,
tim
From: Judd Storrs <address@hidden>
To: CLOSE Dave <address@hidden>
Cc: address@hidden
Sent: Wednesday, June 24, 2009 3:19:34 AM
Subject: Re: Joining arrays
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