MATLAB: How to take the results of a function and introduce them into another

matlab function

I created a if elseif else loop using the circshift function to go through various shifts of a matrix (x from -1 to 1 and y from -1 to 1). I need to go through the various coordinate combinations and save each output in order for me to average them at the end, but I'm having trouble calling to the original function and defining the coordinate variables. This is what I have so far:
function img_out = img_filter(img_in)
img_in = img_shift(img_out);
a = img_in;
b = img_out(a,0,1);
c = img_out(a,0,-1);
d = img_out(a,-1,-1);
e = img_out(a,1,0);
f = img_out(a,-1,0);
g = img_out(a,-1,1);
h = img_out(a,1,-1);
i = img_out(a,1,1);
p_avg = (a+b+c+d+e+f+g+h+i)./9
end

Best Answer

It is difficult for me to understand what you want to do, since you have not described it.
You have not called ‘img_shift’ with enough input arguments here:
img_in = img_shift(img_out);
since ‘horiz’ and ‘vert’ do not have default values, and you do not have any check to see if you have passed those arguments to it.
You may actually want to do this:
b = img_shift(a,0,1);
and so for the others.