matlab里.m文件运行出错

我从Matlab 7 主窗口的“file”-“New”-“M-File”进入“Editor-Untitled3”编辑窗口写.m文件,保存后运行错误。显示以下信息,我不知道是怎么回事,请高手帮忙一下,小弟在此谢过了。“AD=fix((10-1)*rand(5)+1)”这是我写的.m文件。下面是运行后在主窗口显示的错误提示: ??? Error: File: D:MatlabworkAD.m Line: 1 Column: 1 The variable "AD" is also the name of this script. This is illegal, because it will be the name of a script and a variable in any context from which the script is called.

解答:系统提示的意思是
错误:文件:
D:MatlabworkAD.m的第一行第一列
变量名
,也是这个脚本的名称。
这是非法的,因为脚本和变量会发生混乱
任何情况下变量名和脚本名是不能相同的。
故修改任意一个名就行了。。
matlab学习群:24358390
温馨提示:答案为网友推荐,仅供参考
相似回答
大家正在搜