fork(4) download
  1. tmat=...
  2. @(M)conv2(M.*(M>0),(x='aba')~=x','same')
  3.  
  4. A = [ 1 2 3;
  5. 4 -1 -2;
  6. -3 -4 10;
  7. 1 2 10];
  8.  
  9. tmat(A)
  10.  
  11.  
Success #stdin #stdout 0.47s 121792KB
stdin
Standard input is empty
stdout
tmat =

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

ans =

    6    4    2
    1    6   13
    5   12   10
    2   11   12