Multiplying vector members without repeating

9 vues (au cours des 30 derniers jours)
giometar
giometar le 4 Juil 2018
Commenté : giometar le 4 Juil 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

Réponse acceptée

Stephen23
Stephen23 le 4 Juil 2018
Modifié(e) : Stephen23 le 4 Juil 2018
>> A = 1:4;
>> prod(nchoosek(A,2),2)
ans =
2
3
4
6
8
12
  1 commentaire
giometar
giometar le 4 Juil 2018
So simple :-) Thank you very much

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by