xinqing2004 发表于 2006-10-10 20:57

一个小问题,请各位帮忙解决

>> = reducevolume(x,y,z,v,2);
??? Attempt to execute SCRIPT reducevolume as a function.怎么解决这个问题?

eight 发表于 2006-10-10 21:15

原帖由 xinqing2004 于 2006-10-10 20:57 发表
>>= reducevolume(x,y,z,v,2);
??? Attempt to execute SCRIPT reducevolume as a function.怎么解决这个问题?


reducevolume是你自己定义的函数吗?

xinqing2004 发表于 2006-10-10 21:45

不是的

不知道怎么回事,以前都没有遇到这个问题,今天怎么就老出现
举个例子:
>> t = (1/16:1/8:1)'*2*pi;
>> x = sin(t);
>> y = cos(t);
>> fill(x,y,'r')
??? Attempt to execute SCRIPT fill as a function.
很奇怪! 怎么说fill 是个SCRIPT?

xinqing2004 发表于 2006-10-10 22:26

我如果把这些语句先放在m文件里执行,出现??? Attempt to execute SCRIPT fill as a function.警告句之后,再放入命令栏里直接一条一条执行就会出现这种情况。以前都是可以在命令栏里执行的,不知道为什么会出现这种现象?:'(

jimin 发表于 2006-10-10 22:30

你用的是什么文件名,fill吗
这个是不能用的,是的话,换一个吧
>> which fill all
F:\MATLAB7\toolbox\matlab\specgraph\fill.bi
把除了上面的其他的删除掉,保存为其他的m文件名再试试

[ 本帖最后由 jimin 于 2006-10-10 22:32 编辑 ]

yqchenlolo 发表于 2006-10-10 22:41

重名?
下面是我在matlab主页上找到的
Subject:
Why do I receive the error "Attempt to execute SCRIPT as a function" ?

Problem Description:
I receive the error:
??? Attempt to execute SCRIPT untitled as a function.


Solution:
This error results because there is a script M-file named <filename> and your calling syntax requires that this script either takes arguments or returns values, which are properties of a function and not of a script.

This can happen because there is a script <filename> and a function <filename> that both exist on the path. If the script appears before the function on the path, then your commands will attempt to use it instead of the function. You may use the command:

which <filename>

to determine which instance of <filename> that MATLAB is attempting to call. If you want to see all instances of a function on the path, type the command:

which <filename> -all

Alternatively, such behavior may occur in certain scenarios where your filename contains invalid characters. In particular, you may see this error if the filename contains characters that are MATLAB operators such as -, +, or *. M-file filenames must begin with a letter, which may be followed by any combination of letters, digits, and underscores.

xinqing2004 发表于 2006-10-12 20:56

谢谢各位的帮助!

jeremygr 发表于 2006-10-12 21:26

本论坛高手很多啊,呵呵
页: [1]
查看完整版本: 一个小问题,请各位帮忙解决