0001 function [avgimg] = average_interp(interp_data,plot_res,samps2average)
0002
0003
0004
0005
0006
0007
0008
0009
0010 dims = size(interp_data);
0011 ndim = length(dims);
0012
0013 if ndim == 3
0014 if (dims(1) ~= dims(2)) & (dims(1) ~= plot_res)
0015 error('Do not understand dimensionality: %s', sprintf('%d ', dims))
0016 end
0017 end
0018
0019 navg = length(samps2average);
0020
0021 avgimg = 0;
0022
0023 if ndim == 2
0024 for isamp = 1:navg
0025 avgimg = avgimg + ...
0026 interp_data(:,(samps2average(isamp)-1)*plot_res+1:samps2average(isamp)*plot_res);
0027 end
0028 avgimg = avgimg/navg;
0029 else
0030 avgimg = mean(interp_data(:,:,samps2average),3);
0031 end
0032
0033 return