MATLAB: Fast way to replace elements in a matrix

matrix efficiency

Hi,
for eample I have an a matrix
a =
245 255 255
254 252 255
251 250 239
rules:
find the row index where all 3 numbers in the row are greater than 250.
Is there a faster way to achieve it than do it in a loop?

Best Answer

idx=all(a>250,2) % logical index
L_idx=find(idx) % linear index , gives row number