MATLAB: How to Shorten This Logical Expression

logical expression

What is the best way to rewrite A in the shortest way?
B = 1:14;
A = B == 1 | B == 2 | B == 3 | B == 7 ;

Best Answer

A = ismember(B,[1 2 3 7])