MATLAB Programming 3 For the arrays x and y given below use
MATLAB Programming:
3. For the arrays x and y given below, use MATLAB to find all the elements in x that are greater than the corresponding elements in y.
x = [-3, 0, 0, 2, 6, 8]
y = [-5, -2, 0, 3, 4, 10]
Solution
x = [-3, 0, 0, 2, 6, 8];
 y = [-5, -2, 0, 3, 4, 10];
 [r c]=size(x);%c gives number of elements in given vector
 index = 1;
 for i=1:c
 if x(i)>y(i)%checks weather the element in x is greater than the corresponding element in y
 greatx(index)=x(i);
 index = index+1;
 end
 end
 disp(greatx);
output:
-3 0 6
>>

