\t\tmatlab常见的程序出错问题整理【转载】

1.Subscript indices must either be real positive integers or logicals

中文解释:下标索引必须是正整数类型或者逻辑类型

出错原因:在访问矩阵(包括向量、二维矩阵、多维数组,下同)的过程中,下标索引要么从 0 开始,要么出现了负数。注:matlab 的语法规定矩阵的索引从 1 开始,这与 C 等编程语言的习惯不一样。

解决办法:自己调试一下程序,把下标为 0 或者负数的地方修正。

2.Undefined function or variable "a"

中文解释:函数或变量 a 没有定义

3.Input argument "x" is undefined

中文解释:输入变量 x 没有定义

4.Matrix dimensions must agree

Inner matrix dimensions must agree

中文解释:矩阵的维数必须一致

出错原因:这是由于运算符(= + - / * 等)两边的运算对象维数不匹配造成的,典型的出错原因是错用了矩阵运算符。matlab 通过“.”来区分矩阵运算和元素运算

5.Function definitions are not permitted at the prompt or in scripts

中文解释:不能在命令窗口或者脚本文件中定义函数

出错原因:一旦在命令窗口写 function c = myPlus(a,b),此错误就会出现,因为函数只能定义在 m 文件中

6. 1) X must have one or two columns

     2.)Vectors must be the same lengths

中文解释:

1. X 必须是 1 或者 2 列

2. 向量长度必须一致

7.One or more output arguments not assigned during call to '...'

中文解释:在调用...函数过程中,一个或多个输出变量没有被赋值

8.??? Error using ==> mpower

Matrix must be square

中文解释:错误使用mpwoer函数,要求矩阵必须是方阵

9.Explicit integral could not be found.

中文解释:显式解没有找到

10.Index exceeds matrix dimensions.

Attempted to access b(3,2); index out of bounds because size(b)=[2,2].

中文解释:索引超出矩阵的范围

11.In an assignment   A(I) = B, the number of elements in B and I must be the same

中文解释:在赋值语句 A(I) = B 中,B 和 I 的元素个数必须相同

12.To RESHAPE the number of elements must not change

中文解释:矩阵变换时,变换前和变换后的总元素不能改变

转载地址:http://blog.163.com/hit_sa/blog/static/121173682200992094054843/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值