Question: how does gcd work in matlab?
Answer: gcd (MATLAB Functions) G = gcd(A,B) returns an array containing the greatest common divisors of the corresponding elements of integer arrays A and B . By convention, gcd(0,0) returns a value of 0 ; all other inputs return positive integers for G .