MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [求助]一个简单的循环,查不出哪里错了 (https://www.labfans.com/bbs/showthread.php?t=6168)

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:


所有时间均为北京时间。现在的时间是 11:16

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.