Multiplying vector members without repeating

Hi I need to multiply values from one vector in all combinations. For example Lets say that vector A=[1 2 3 4]' I need to get these products 1*2 1*3 1*4 2*3 2*4 3*4
Thanks for help

 採用された回答

Stephen23
Stephen23 2018 年 7 月 4 日
編集済み: Stephen23 2018 年 7 月 4 日

0 投票

>> A = 1:4;
>> prod(nchoosek(A,2),2)
ans =
2
3
4
6
8
12

1 件のコメント

giometar
giometar 2018 年 7 月 4 日
So simple :-) Thank you very much

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with MATLAB についてさらに検索

質問済み:

2018 年 7 月 4 日

コメント済み:

2018 年 7 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by