Why do I get Type Mismatch errors when working with matrices in MatrixVB?
11 次查看(过去 30 天)
显示 更早的评论
I am performing simple arithmetic on matrices in MatrixVB. When I do, I receive the following Microsoft Visual Basic error:
Run-time Error '13':
Type mismatch
采纳的回答
MathWorks Support Team
2009-8-7
The "type mismatch" error is likely due to your using arithmetic operators (+, - , *, or / ) to perform mathematical operations.
Instead, you should use MatrixVB functions (plus, minus, times, rdivide) to operate on matrices.
For example, instead of:
Dim x As Variant
Dim a As Double
'Calculate an angle
a = 0.18
x = angle(msqrt(-1) * a)
Use:
Dim x As Variant
Dim a As Double
'Calculate an angle
a = 0.18
x = angle(times(msqrt(-1), a))
For more information on MatrixVB arithmetic functions, consult the MatrixVB documentation: "Chapter 4: Operators".
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Operators and Elementary Operations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!