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:
permute the elements in a vector

Subject: permute the elements in a vector

From: Wendy

Date: 1 Dec, 2011 10:34:08

Message: 1 of 2

Hi all,

I have a vector, e.g., A = [10 20 30 40]. There are 4! = 24 different ordering of these 4 elements. I want to generate a matrix with one combination in one row, so the output would be something like

B = [
10 20 30 40
10 40 20 30
10 40 30 20
...
]

Do anyone know how to do this easily in Matlab?

Thank you in advance.

Wendy

Subject: permute the elements in a vector

From: Torsten

Date: 1 Dec, 2011 10:56:53

Message: 2 of 2

On 1 Dez., 11:34, "Wendy " <wlq...@gmail.com> wrote:
> Hi all,
>
> I have a vector, e.g., A = [10 20 30 40]. There are 4! = 24 different ordering of these 4 elements. I want to generate a matrix with one combination in one row, so the output would be something like
>
> B = [
> 10 20 30 40
> 10 40 20 30
> 10 40 30 20
> ...
> ]
>
> Do anyone know how to do this easily in Matlab?
>
> Thank you in advance.
>
> Wendy


http://www.mathworks.de/help/techdoc/ref/perms.html

Best wishes
Torsten.

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