Transform a matrix

MATL, 9 bytes

t0>*1Y6Z+

Try it online!

Explanation

The input matrix is multplied by an appropriate mask to make negative values equal to 0. Then a 2D convolution is applied to compute the sum of neighbours of each entry.

t     % Take input implicitly: 2D array. Duplicate
0>    % Is each entry positive? This gives a mask of positive values
*     % Multiply: set negative values of input array to zero
1Y6   % Predefined literal: [0 1 0; 1 0 1; 0 1 0]
Z+    % 2D convolution preserving size. Implicitly display

Octave, 46 44 40 bytes

Saved 2 bytes thanks to @flawr
@LuisMendo's kernel was 4 bytes shorter than @flawr's.

@(M)conv2(M.*(M>0),(x='aba')~=x','same')

Just like @LuisMendo's answer! Only less... golfy.

You can see it here on ideone.


JavaScript (ES6), 99 94 bytes

a=>a.map((b,i)=>b.map((_,j)=>(g=(c=j,k=j)=>c[k]>0&&c[k])(a[i-1])+g(a[i+1])+g(b,j-1)+g(b,j+1)))

Accepts and returns a two-dimensional array.

Edit: Completely rewritten when I discovered that default arguments work when you pass an explicitly undefined value, such as when you index off the end of an array.