Cody

# Problem 2234. Find and replace the zero array in a matrix

Solution 423329

Submitted on 27 Mar 2014 by Richard Zapor
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% A=[3,5,7,90,1;5,1,-1,0,2;1,2,3,4,70;23,1,2,3,5]; B= 23.75; tolerance = 1e-2 ; assert(abs(adjacent_averaging(A)-B)<tolerance);

A = 5.0000 3.6667 31.3333 2.6667 46.0000 1.6667 2.7500 2.7500 23.7500 23.6667 10.0000 1.5000 1.7500 19.0000 3.6667 1.0000 9.0000 2.3333 3.6667 36.5000

2   Pass
%% A=[1,1,0,1,1;2,2,2,2,2;3,3,3,3,3;4,4,4,4,4]; B= 1.3333; tolerance = 1e-2 ; assert(abs(adjacent_averaging(A)-B)<tolerance);

A = 1.5000 1.0000 1.3333 1.0000 1.5000 2.0000 2.0000 1.7500 2.0000 2.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.5000 3.6667 3.6667 3.6667 3.5000

3   Pass
%% A=[3,3,3,90,2;5,3,-1,6,4;2,0,5,6,80;12,9,12,13,15]; B= 4.75; tolerance = 1e-2 ; assert(abs(adjacent_averaging(A)-B)<tolerance);

A = 4.0000 3.0000 30.6667 3.6667 47.0000 2.6667 1.7500 4.2500 24.7500 29.3333 5.6667 4.7500 4.2500 26.0000 8.3333 5.5000 8.0000 9.0000 11.0000 46.5000

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!