Multiplying vector members without repeating

1 回表示 (過去 30 日間)
giometar
giometar 2018 年 7 月 4 日
コメント済み: giometar 2018 年 7 月 4 日
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 日
>> 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 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by