I'm trying to write a script that performs a function on each cell in an array (elevation data, for context).
I need to find a value for each cell depending on those in its neighborhood (neighborhood size unimportant just now)
I'm using nlfilter to do this. The function involves several steps, and the inputs for the function will depend on the values within each neighborhood, so:
output = nlfilter(input,neighborhood_size,function);function a = fun_name(neighborhood)neighborhood_mean = mean2(neighborhood); ...etc
'function' needs to find the mean of each neighborhood, then subtract this mean from each cell in the neighborhood, and find the mean value of cells where mean>0.
There are several further steps but they depend on me being able to complete the above.
How do I specify that the input arguments for the function are whatever is in the neighborhood at the time?
Best Answer