How to take the product of distinct array values?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Sean
am 25 Jun. 2014
Kommentiert: Sean
am 25 Jun. 2014
clc;
clear all;
close all;
Bx = 720;
By = 360;
g = gcd(Bx,By);
f = factor(g);
f_prod = prod(f);
In this example f = [ 2 2 2 3 3 5 ], and prod(f) = 360, but I just want to receive the product of distinct primes (i.e. 2*3*5). Is there a way to do this?
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Special Functions finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!