Borrar filtros
Borrar filtros

Multiplying vector members without repeating

2 visualizaciones (últimos 30 días)
giometar
giometar el 4 de Jul. de 2018
Comentada: giometar el 4 de Jul. de 2018
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

Respuesta aceptada

Stephen23
Stephen23 el 4 de Jul. de 2018
Editada: Stephen23 el 4 de Jul. de 2018
>> A = 1:4;
>> prod(nchoosek(A,2),2)
ans =
2
3
4
6
8
12

Más respuestas (0)

Categorías

Más información sobre Elementary Math en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by