Combination of the value of different vectors into one matrix ?

Dear MATLAB users
I would like to combine all the values of lets say 3 vectors into one matrix. I think an example will make my question clear. If we have 3 vectors:
A= [1,2,3]
B=[5,6]
C=[7,8,9]
I want as solution a matrix of 3 colums with makes all possible combinations of the different values of A,B and C.
So
[1 5 7;
1 5 8;
1 5 9;
1 6 7;
1 6 8;
1 6 9;
2 5 7;
2 5 8;
2 5 9;
2 6 7;
2 6 8;
2 6 9;
3 5 7;
3 5 8;
3 5 9;
3 6 7;
3 6 8;
3 6 9]
Does anyone nows a useful formula for this problem?
Thanks in advance !!! Klaas

4 件のコメント

Mohammad Abouali
Mohammad Abouali 2015 年 1 月 10 日
Did you check my Answer? it is already generating all the possible combination that you asked?
Klaas
Klaas 2015 年 1 月 11 日
Thank you very much !!!! Your answer does exactly what I want.
Klaas
Klaas 2015 年 1 月 19 日
編集済み: Klaas 2015 年 1 月 19 日
Hellow
I'm making a plot now of these matrix but I would like to now witch point is made with witch values. Is there a way to let this happen?
Thanks in advance
Klaas
Mohammad Abouali
Mohammad Abouali 2015 年 1 月 19 日
This is a different question and it is rather not clear for me what you are asking.
Please accept the answer provided to your original question and then post a new question on the board.

サインインしてコメントする。

回答 (1 件)

Shoaibur Rahman
Shoaibur Rahman 2015 年 1 月 11 日

2 投票

out = combvec(A,B,C)'

1 件のコメント

Mohammad Abouali
Mohammad Abouali 2015 年 1 月 11 日
That's part of Neural Network toolbox. Not everyone has it.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

タグ

質問済み:

2015 年 1 月 10 日

コメント済み:

2015 年 1 月 19 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by