Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
need help with making matrix

Subject: need help with making matrix

From: si yeol Shin

Date: 3 Apr, 2011 08:03:04

Message: 1 of 3

hello~
i'm trying to make a matrix by below matrixes.
x=[1,2,3]
y=[3,4,5]

then the result would be

a=
1,3
1,4
1,5
2,3
2,4
2,5
3,3
3,4
3,5

the properties in x is on the column 1 and the properties in y is on the column 2.
how can i make the code?

Subject: need help with making matrix

From: Bruno Luong

Date: 3 Apr, 2011 10:42:04

Message: 2 of 3

"si yeol Shin" wrote in message <in99jo$74a$1@fred.mathworks.com>...
> hello~
> i'm trying to make a matrix by below matrixes.
> x=[1,2,3]
> y=[3,4,5]
>
> then the result would be
>
> a=
> 1,3
> 1,4
> 1,5
> 2,3
> 2,4
> 2,5
> 3,3
> 3,4
> 3,5
>
> the properties in x is on the column 1 and the properties in y is on the column 2.
> how can i make the code?

>> x=[1,2,3]
y=[3,4,5]

x =

     1 2 3


y =

     3 4 5

>> [X Y]=meshgrid(x,y)

X =

     1 2 3
     1 2 3
     1 2 3


Y =

     3 3 3
     4 4 4
     5 5 5

>> a=[X(:) Y(:)]

a =

     1 3
     1 4
     1 5
     2 3
     2 4
     2 5
     3 3
     3 4
     3 5

% Bruno

Subject: need help with making matrix

From: si yeol Shin

Date: 4 Apr, 2011 00:32:04

Message: 3 of 3

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <in9its$mq9$1@fred.mathworks.com>...
> "si yeol Shin" wrote in message <in99jo$74a$1@fred.mathworks.com>...
> > hello~
> > i'm trying to make a matrix by below matrixes.
> > x=[1,2,3]
> > y=[3,4,5]
> >
> > then the result would be
> >
> > a=
> > 1,3
> > 1,4
> > 1,5
> > 2,3
> > 2,4
> > 2,5
> > 3,3
> > 3,4
> > 3,5
> >
> > the properties in x is on the column 1 and the properties in y is on the column 2.
> > how can i make the code?
>
> >> x=[1,2,3]
> y=[3,4,5]
>
> x =
>
> 1 2 3
>
>
> y =
>
> 3 4 5
>
> >> [X Y]=meshgrid(x,y)
>
> X =
>
> 1 2 3
> 1 2 3
> 1 2 3
>
>
> Y =
>
> 3 3 3
> 4 4 4
> 5 5 5
>
> >> a=[X(:) Y(:)]
>
> a =
>
> 1 3
> 1 4
> 1 5
> 2 3
> 2 4
> 2 5
> 3 3
> 3 4
> 3 5
>
> % Bruno

thank you very much~

Tags for this Thread

No tags are associated with this thread.

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.

Contact us