十分着急,望指点。
15 个解决方案
#1
提示:mtimes 类单元中的变量没有定义
#2
不懂,帮顶
#3
不懂,帮顶
#4
mtimes好像是matlab的底层函数?反正在m文件是没有直接用到的
#5
我试过了,调用的matlab函数里有矩阵运算,如相乘等,就会出现上面的错误提示。晕,matlab最强大的就是矩阵运算,如果这样的函数都不能调用,那还有什么意义。唉,等高手解决。。。。。
#6
MATLAB制作成COM或编译为EXE文件时,似乎并不能使用所有的函数,但是基本的函数运算还是支持的. 你MATLAB用的是多少版本?
#7
之前用的是7.0,今晚换了2008a,问题如故。矩阵相乘不行,估计调用了matlab的什么底层函数吧。郁闷啊
#8
mark
#9
mark
#10
再补充一下,最简单的m函数,如矩阵a*b,调用都会出现Function mtimes not defined for variables of class'cell'的错误。
源代码:
m函数:
function y=mul1(a,b)
y=a*b;
return
vb代码:(mu22为生成的com组件名称)
Private themul As mu22.mu22class
Private a(3, 3) As Variant, b(3, 3) As Variant
Private Sub Command1_Click()
Dim y(3, 3) As Variant
Call themul.mul1(1, y, a, b)
End Sub
Private Sub Form_Load()
Set themul = New mu22.mu22class
a(1, 1) = 1
a(1, 2) = 2
a(1, 3) = 3
a(2, 1) = 3
a(2, 2) = 2
a(2, 3) = 1
a(3, 1) = 1
a(3, 2) = 3
a(3, 3) = 2
b(1, 1) = 1
b(1, 2) = 1
b(1, 3) = 2
b(2, 1) = 2
b(2, 2) = 2
b(2, 3) = 3
b(3, 1) = 3
b(3, 2) = 3
b(3, 3) = 2
End Sub
源代码:
m函数:
function y=mul1(a,b)
y=a*b;
return
vb代码:(mu22为生成的com组件名称)
Private themul As mu22.mu22class
Private a(3, 3) As Variant, b(3, 3) As Variant
Private Sub Command1_Click()
Dim y(3, 3) As Variant
Call themul.mul1(1, y, a, b)
End Sub
Private Sub Form_Load()
Set themul = New mu22.mu22class
a(1, 1) = 1
a(1, 2) = 2
a(1, 3) = 3
a(2, 1) = 3
a(2, 2) = 2
a(2, 3) = 1
a(3, 1) = 1
a(3, 2) = 3
a(3, 3) = 2
b(1, 1) = 1
b(1, 2) = 1
b(1, 3) = 2
b(2, 1) = 2
b(2, 2) = 2
b(2, 3) = 3
b(3, 1) = 3
b(3, 2) = 3
b(3, 3) = 2
End Sub
#11
'已经在MATLAB6.5中调试通过,其它版本应该没问题
Option Base 1
Private themul As mu22.mu22
Private a(3, 3) As Double, b(3, 3) As Double
Private Sub Command1_Click()
Dim y As Variant '关键在这里
Dim i As Integer, j As Integer
Set themul = New mu22.mu22
a(1, 1) = 1
a(1, 2) = 2
a(1, 3) = 3
a(2, 1) = 3
a(2, 2) = 2
a(2, 3) = 1
a(3, 1) = 1
a(3, 2) = 3
a(3, 3) = 2
b(1, 1) = 1
b(1, 2) = 1
b(1, 3) = 2
b(2, 1) = 2
b(2, 2) = 2
b(2, 3) = 3
b(3, 1) = 3
b(3, 2) = 3
b(3, 3) = 2
Call themul.mul1(1, y, a, b)
For i = 1 To 3
For j = 1 To 3
Print y(i, j);
Next
Print
Next
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set themul = Nothing
End Sub
Option Base 1
Private themul As mu22.mu22
Private a(3, 3) As Double, b(3, 3) As Double
Private Sub Command1_Click()
Dim y As Variant '关键在这里
Dim i As Integer, j As Integer
Set themul = New mu22.mu22
a(1, 1) = 1
a(1, 2) = 2
a(1, 3) = 3
a(2, 1) = 3
a(2, 2) = 2
a(2, 3) = 1
a(3, 1) = 1
a(3, 2) = 3
a(3, 3) = 2
b(1, 1) = 1
b(1, 2) = 1
b(1, 3) = 2
b(2, 1) = 2
b(2, 2) = 2
b(2, 3) = 3
b(3, 1) = 3
b(3, 2) = 3
b(3, 3) = 2
Call themul.mul1(1, y, a, b)
For i = 1 To 3
For j = 1 To 3
Print y(i, j);
Next
Next
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set themul = Nothing
End Sub
#12
11楼正解,呵呵,终于解决了,谢谢啊。也谢谢帮顶的兄弟。
#13
向各位仁兄学习!顶!
#14
新人过来顶贴
#15
11楼正解!!!!!!!!!!!!!!!
#1
提示:mtimes 类单元中的变量没有定义
#2
不懂,帮顶
#3
不懂,帮顶
#4
mtimes好像是matlab的底层函数?反正在m文件是没有直接用到的
#5
我试过了,调用的matlab函数里有矩阵运算,如相乘等,就会出现上面的错误提示。晕,matlab最强大的就是矩阵运算,如果这样的函数都不能调用,那还有什么意义。唉,等高手解决。。。。。
#6
MATLAB制作成COM或编译为EXE文件时,似乎并不能使用所有的函数,但是基本的函数运算还是支持的. 你MATLAB用的是多少版本?
#7
之前用的是7.0,今晚换了2008a,问题如故。矩阵相乘不行,估计调用了matlab的什么底层函数吧。郁闷啊
#8
mark
#9
mark
#10
再补充一下,最简单的m函数,如矩阵a*b,调用都会出现Function mtimes not defined for variables of class'cell'的错误。
源代码:
m函数:
function y=mul1(a,b)
y=a*b;
return
vb代码:(mu22为生成的com组件名称)
Private themul As mu22.mu22class
Private a(3, 3) As Variant, b(3, 3) As Variant
Private Sub Command1_Click()
Dim y(3, 3) As Variant
Call themul.mul1(1, y, a, b)
End Sub
Private Sub Form_Load()
Set themul = New mu22.mu22class
a(1, 1) = 1
a(1, 2) = 2
a(1, 3) = 3
a(2, 1) = 3
a(2, 2) = 2
a(2, 3) = 1
a(3, 1) = 1
a(3, 2) = 3
a(3, 3) = 2
b(1, 1) = 1
b(1, 2) = 1
b(1, 3) = 2
b(2, 1) = 2
b(2, 2) = 2
b(2, 3) = 3
b(3, 1) = 3
b(3, 2) = 3
b(3, 3) = 2
End Sub
源代码:
m函数:
function y=mul1(a,b)
y=a*b;
return
vb代码:(mu22为生成的com组件名称)
Private themul As mu22.mu22class
Private a(3, 3) As Variant, b(3, 3) As Variant
Private Sub Command1_Click()
Dim y(3, 3) As Variant
Call themul.mul1(1, y, a, b)
End Sub
Private Sub Form_Load()
Set themul = New mu22.mu22class
a(1, 1) = 1
a(1, 2) = 2
a(1, 3) = 3
a(2, 1) = 3
a(2, 2) = 2
a(2, 3) = 1
a(3, 1) = 1
a(3, 2) = 3
a(3, 3) = 2
b(1, 1) = 1
b(1, 2) = 1
b(1, 3) = 2
b(2, 1) = 2
b(2, 2) = 2
b(2, 3) = 3
b(3, 1) = 3
b(3, 2) = 3
b(3, 3) = 2
End Sub
#11
'已经在MATLAB6.5中调试通过,其它版本应该没问题
Option Base 1
Private themul As mu22.mu22
Private a(3, 3) As Double, b(3, 3) As Double
Private Sub Command1_Click()
Dim y As Variant '关键在这里
Dim i As Integer, j As Integer
Set themul = New mu22.mu22
a(1, 1) = 1
a(1, 2) = 2
a(1, 3) = 3
a(2, 1) = 3
a(2, 2) = 2
a(2, 3) = 1
a(3, 1) = 1
a(3, 2) = 3
a(3, 3) = 2
b(1, 1) = 1
b(1, 2) = 1
b(1, 3) = 2
b(2, 1) = 2
b(2, 2) = 2
b(2, 3) = 3
b(3, 1) = 3
b(3, 2) = 3
b(3, 3) = 2
Call themul.mul1(1, y, a, b)
For i = 1 To 3
For j = 1 To 3
Print y(i, j);
Next
Print
Next
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set themul = Nothing
End Sub
Option Base 1
Private themul As mu22.mu22
Private a(3, 3) As Double, b(3, 3) As Double
Private Sub Command1_Click()
Dim y As Variant '关键在这里
Dim i As Integer, j As Integer
Set themul = New mu22.mu22
a(1, 1) = 1
a(1, 2) = 2
a(1, 3) = 3
a(2, 1) = 3
a(2, 2) = 2
a(2, 3) = 1
a(3, 1) = 1
a(3, 2) = 3
a(3, 3) = 2
b(1, 1) = 1
b(1, 2) = 1
b(1, 3) = 2
b(2, 1) = 2
b(2, 2) = 2
b(2, 3) = 3
b(3, 1) = 3
b(3, 2) = 3
b(3, 3) = 2
Call themul.mul1(1, y, a, b)
For i = 1 To 3
For j = 1 To 3
Print y(i, j);
Next
Next
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set themul = Nothing
End Sub
#12
11楼正解,呵呵,终于解决了,谢谢啊。也谢谢帮顶的兄弟。
#13
向各位仁兄学习!顶!
#14
新人过来顶贴
#15
11楼正解!!!!!!!!!!!!!!!