function x=indexcat(y,val); % PURPOSE: Extract indices for y being equal to val if val is a scaler % or extract indices for y being val(1)val(1)).*(y