function K = IAS_W4K(W,p,q)
% IAS_W4K - convert a 4D weight array to a 2D kernel
% On input:
%     W (weight array MxNx1x4): weight array
%     p (int): selects which 3rd dim plane MxN weight array
%     q (int): selects which 4th dim plane MxN weight array
% On output:
%     K (MxN array): kernel
% Call:
%     K = IAS_W4K(W,1,1);
% Author:
%     T. Henderson
%     UU
%     Spring 2025
%

[M,N,P,Q] = size(W);
K = zeros(M,N);

for r = 1:M
    for c = 1:N
        K(r,c) = W(r,c,p,q);
    end
end
