MATLAB: How to multiply a row of matrix

homeworkmatrixmultiplynumberodd

Hello
I've got this problem I want to find every odd number that are between two other numbers so I developed this code:
if true
a=input ('add your number here:');
b=input ('add your number here:');
if mod (a,2)==0;
N=a+1:2:b;
else mod (a,2)=1;
N=a:2:b;
end
now I want to multiply all of N's elements, but I don't know how. like if its A=[3,5,7], I want it to be B=3x5x7

Best Answer

Simpler:
>> a = 4;
>> b = 10;
>> V = a+~mod(a,2):2:b
V =
5 7 9
to multiply all of the elements of the vector V together use prod:
>> prod(V)
ans = 315