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=5015)

huanghuan 2008-10-26 20:58

[求助]请大家看一下
 
function [a]=sul(n)
if n==1
a=1;
else if n==2
a=2;
end
b(1)=1;
b(2)=2;
for i=3:n
b(i)=b(i-2)+b(i-1);
end
a=b;
end
出现了如下提示:
??? Strings passed to EVAL cannot contain function declarations.
怎么回事呀?

myci 2008-10-26 21:26

回复: [求助]请大家看一下
 
呵呵 路过看一下 你的n是多少?

littleprincels 2008-10-28 16:54

回复: [求助]请大家看一下
 
把 function 去掉,试试, function 在命令窗口中出现的话,可能会出错!!

remnant 2008-10-30 00:29

回复: [求助]请大家看一下
 
我运行没问题。你看下是否有不恰当的调用。
提示说传递给EVAL的字串不包含函数的声明。


所有时间均为北京时间。现在的时间是 13:36

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