MATLAB: Extracting values in 2D dataset with indices for lat and lon

2dfindindiceslatitudelongitudenan

Hello
I have a very simple problem:
I have a vector of indices I extracted for a latitude vector and a longitude vector. I would like to find the corresponding value at the specific latitude and longitude indices.
EX:
lat_indices = 471×1 lon_indices 471×1 data = 7200×3600 values = data(lon_indices lat_indices);
When I use this method, I keep getting all of the values as NaN, but I know that is incorrect.
Am I doing this the wrong way?
Thanks, Melissa

Best Answer

Do you simply need a comma? You wrote,
values = data(lon_indices lat_indices);
Perhaps it should be
values = data(lon_indices,lat_indices);