登录论坛

查看完整版本 : [求助]一个简单的循环,查不出哪里错了


will99031827
2009-01-06, 22:21
代码如下:
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".)

各位大哥路过此地的,给个答案。拜托了!
第一次发帖,大家新年好!!:confused:

will99031827
2009-01-06, 22:37
搞定了
For应该小写
我晕:ft: