I had this same problem today while performing a range search. Through a little fiddling, I managed to find a solution. The trick is to turn everything into a cell and perform cellfun .
searcher = @(X, Y, Radius) rangesearch(X, Y, Radius);
Now let's convert all of your data to cells. The only caveat is that data, track, and radius must have the same height. So if you want to use a particular radius on multiple searches, you must repeat that element in the radius matrix. So given that data is size [n, 2], track is size [n, 2], and radius is size [n, 1]
DataCell = mat2cell(data, ones(length(data), 1), 2);
TrackCell = mat2cell(track, ones(length(track), 1), 2);
RadiusCell = num2cell(radius)
Now we can apply the cellfun to these cells with the ability for a flexible search radius.
Result = cellfun(searcher, DataCell, TrackCell, RadiusCell, 'Uni', 0);
where the 'Uni', 0 stands for 'UniformOutput', 'False' because the results may all be different lengths.
Hope this helps you and anyone else who finds it.