>>7
■ mathematica
{1,2,3,4,5}~Select~(2<#<5&) 2

■ matlab
x=[1 2 3 4 5]; x(2<x&x<5).*2