MATLAB: Multiplying adjacent values in matrix

matrix

How do you multiply adjacent values within a single matrix in matlab? My matrix is compiled with the prime numbers before 100. ie. primes(100), if the first values are 2 3 5 7 and i need to multiply 2*3 3*5 5*7 and so on.. thanks!

Best Answer

See if this works for you.
A = primes(100);
B = A(1:end-1) .* A(2:end);
Related Question