MATLAB: Conditional Statements Between Two Arrays

arrayif statement

I am trying to compare each value between two large arrays then store true values as another array. What do I type?

Best Answer

a = 1:100;
b = 1:2:100;
c = ismember(a,b); % index of values of array a inside of array b
d = a(c); % the values inside of a that are in b