%testextract.m % Run this to test your extract function for EE435 Project 1. Note that % your error messages are probably not exactly the same as mine are, but % you should get errors when I do, and the returned matrix v should match % mine each time. This program assumes that the extract function has the % following usage: % % y=extract(x,ulrow,ulcol,rows,cols) x=eye(11); %an 11 x 11 identity matrix for k=2:11 x(k,k)=x(k-1,k-1)+1; end % now matrix x has increasing integer values along main diagonal v=extract(x,4,4,5,5) disp('----------------------------------------------------------------') % should display: % v = % % 4 0 0 0 0 % 0 5 0 0 0 % 0 0 6 0 0 % 0 0 0 7 0 % 0 0 0 0 8 pause v=extract(x,2,3,4,4) disp('----------------------------------------------------------------') % should display: % v = % % 0 0 0 0 % 3 0 0 0 % 0 4 0 0 % 0 0 5 0 % pause v=extract(x,5,6,3,3) disp('----------------------------------------------------------------') % should display: % v = % % 0 0 0 % 6 0 0 % 0 7 0 pause v=extract(x,5,6,4,6) disp('----------------------------------------------------------------') % should display: % % v = % % 0 0 0 0 0 0 % 6 0 0 0 0 0 % 0 7 0 0 0 0 % 0 0 8 0 0 0 % pause v=extract(x,-1,6,2,2) disp('----------------------------------------------------------------') % should display an error message, like this: % % Error: upperleft row or col number is off image, returning original image ! % % % v = % % [] pause v=extract(x,1,6,13,7) disp('----------------------------------------------------------------') % should display an error message, like this: % % Error: subimage > orig image size, returning NULL image ! % % % v = % % []