Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: merge two arrays

Subject: merge two arrays

From: Young Ryu

Date: 15 May, 2008 19:32:01

Message: 1 of 6

Hi-

I have two arrays:
A=
1 2
3 4
5 6

and
B=
7 8
9 10

I tried to merge two arrays like:
C=
1 2
3 4
5 6
7 8
9 10

Is there any simple method for getting C?

Thanks!





Subject: Re: merge two arrays

From: CandyGirl

Date: 15 May, 2008 19:56:17

Message: 2 of 6

If you defined A and B as a matrices you could do it.
i.e :

A=[1,2;3,4;5,6], B=[7,8;9,10], and define C as
C=[A;B]

To be honest, I'm not very familiar with arrays.

sorry ;)

Subject: Re: merge two arrays

From: Jos

Date: 15 May, 2008 20:02:02

Message: 3 of 6

"Young Ryu" <ryuyr77@gmail.com> wrote in message
<g0i33h$ntr$1@fred.mathworks.com>...
> Hi-
>
> I have two arrays:
> A=
> 1 2
> 3 4
> 5 6
>
> and
> B=
> 7 8
> 9 10
>
> I tried to merge two arrays like:
> C=
> 1 2
> 3 4
> 5 6
> 7 8
> 9 10
>
> Is there any simple method for getting C?
>
> Thanks!
>
>
>
>
>

look at

help horzcat

and try things out.

Also the "Getting Started" section might be very useful for
you.

hth
Jos

Subject: Re: merge two arrays

From: aasim Azooz

Date: 16 May, 2008 09:47:10

Message: 4 of 6

"Young Ryu" <ryuyr77@gmail.com> wrote in message
<g0i33h$ntr$1@fred.mathworks.com>...
> Hi-
>
> I have two arrays:
> A=
> 1 2
> 3 4
> 5 6
>
> and
> B=
> 7 8
> 9 10
>
> I tried to merge two arrays like:
> C=
> 1 2
> 3 4
> 5 6
> 7 8
> 9 10
>
> Is there any simple method for getting C?
>
> Thanks!
>
>
>
>
> Try
C=[A,B]

Subject: Re: merge two arrays

From: aasim Azooz

Date: 16 May, 2008 09:47:10

Message: 5 of 6

"Young Ryu" <ryuyr77@gmail.com> wrote in message
<g0i33h$ntr$1@fred.mathworks.com>...
> Hi-
>
> I have two arrays:
> A=
> 1 2
> 3 4
> 5 6
>
> and
> B=
> 7 8
> 9 10
>
> I tried to merge two arrays like:
> C=
> 1 2
> 3 4
> 5 6
> 7 8
> 9 10
>
> Is there any simple method for getting C?
>
> Thanks!
>
>
>
>
> Try
C=[A,B]

Subject: Re: merge two arrays

From: Nitin Chhabra

Date: 16 May, 2008 10:03:01

Message: 6 of 6

"aasim Azooz" <aasimazooz@yahoo.com> wrote in message
<g0jl6u$2n3$1@fred.mathworks.com>...
> "Young Ryu" <ryuyr77@gmail.com> wrote in message
> <g0i33h$ntr$1@fred.mathworks.com>...
> > Hi-
> >
> > I have two arrays:
> > A=
> > 1 2
> > 3 4
> > 5 6
> >
> > and
> > B=
> > 7 8
> > 9 10
> >
> > I tried to merge two arrays like:
> > C=
> > 1 2
> > 3 4
> > 5 6
> > 7 8
> > 9 10
> >
> > Is there any simple method for getting C?
> >
> > Thanks!
> >
> >
> >
> >
> > Try
> C=[A,B]
>

Hi,

C=[A;B] ( [A,B] will put them vertically )

cheers,
Nitin

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
homework Jos 15 May, 2008 16:05:10
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics