The issue mentioned by you can be tackled using logical indexing, which is supported by MATLAB. In this, you basically get the indices where both the conditions are true.
Following I have modified your code to get the indices with both the conditions true.
lat_r = A(:, 7);
long_r = A(:, 8);
valid_indices = (lat_r > x & lat_r < y) & (long_r > a & long_r < b);
valid_lat_long = A(valid_indices, [7, 8]);
disp(valid_lat_long);
Hope this helps!
