查看单个帖子
旧 2009-01-06, 22:21   #1
will99031827
初级会员
 
注册日期: 2009-01-06
年龄: 44
帖子: 2
声望力: 0
will99031827 正向着好的方向发展
默认 [求助]一个简单的循环,查不出哪里错了

代码如下:
function A = myHilbert(m,n)
%this is the first function
if nargout>1, error('to many output');end
if nargin ==1, n=m;
elseif nargin==0| nargin >2, error('wrong input');
end

A1 = zeros(m, n);

For i = 1:m
For j = 1:n
A1(i,j)=1/(i+j-1);
end
end

if nargout ==0 disp(A1);
elseif nargout == 1 A = A1;
end

错误提示:
myHilbert.m Line: 14 Column: 1
This statement is not inside any function.
(It follows the END that terminates the definition of the function "myHilbert".)

各位大哥路过此地的,给个答案。拜托了!
第一次发帖,大家新年好!!
will99031827 当前离线   回复时引用此帖