Unformatted text preview: If % the input array is empty, the ouput should be an empty vector (*not* % zero). The function should return the sums in order of most inward % ring first and moving outward from there. % % Notes: % - You may *only* use the following built-in functions: size, sum, % isempty, or length. % - You must use recursion to receive any credit. % function out = ringSum(in) [r c] = size(in); if isempty(in) out = ; elseif r<=2 || c<=2 out = sum(sum(in)); else out = [ringSum(in(2:end-1, 2:end-1)) sum(sum(in))-sum(ringSum(in(2:end-1, 2:end-1)))]; end...
View Full Document
This note was uploaded on 10/22/2009 for the course CS 1371 taught by Professor Stallworth during the Fall '08 term at Georgia Tech.
- Fall '08