11/10/11 2:09 AM

D:\My Documents\MATLAB\matrix.m

function [answer]=matrix (m,n)
switch nargin
case 0
error('input m and n')
case 1
error('input n')
end
a=length(m);b=length(n);
s=zeros(a,b);
s(:,1)=m;
s(1,:)=s(1,:)+n;
for i=2:a
for j=2:b
s(i,j)=sum(single(s(i,:)))+sum(single(s(:,j)));
end
end
s
end

1 of 1

Sign up to vote on this title
UsefulNot useful