Multiplying vector members without repeating

조회 수: 2 (최근 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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Elementary Math에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by