VB中的错误:类型不匹配,缺少数组或用户定义类型,高手帮忙啊!
ReDimINDX(1ToNNVariable%*TotalNode%)AsInteger这个是定义CallLUDCMP(al#(),N,INDX%(),p)调用函数,就...
ReDim INDX(1 To NNVariable% * TotalNode%) As Integer
这个是定义
Call LUDCMP(al#(), N, INDX%(), p)
调用函数,就出现错误,说是INDX%()类型不匹配,这个是什么原因啊,我定义的了。
Sub Gauss_Elimation(a#(), b#())
Dim N As Integer '方程的维数
Dim i As Integer
Dim j As Integer
Dim l As Integer
ReDim al(1 To NNVariable% * TotalNode%, 1 To NNVariable% * TotalNode%) As Double
ReDim x(1 To NNVariable% * TotalNode%) As Double
Dim p As Integer
ReDim INDX(1 To NNVariable% * TotalNode%) As Integer
N = UBound(a#, 1)
For i = 1 To N
For j = 1 To N
al(i, j) = a(i, j)
Next j
Next i
Call LUDCMP(al#(), N, INDX%(), p)
For l = 1 To N
x(l) = b(l)
Next l
Call LUBKSB(al#(), N, INDX%(), x#())
End Sub
Sub LUDCMP(a#(), N, INDX%(), d)
Dim nmax As Double
Dim tiny As Double
Dim aamax As Double
ReDim VV(1 To NNVariable% * TotalNode%) As Double
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim sum As Double
Dim dum As Double
Dim imax As Integer 展开
这个是定义
Call LUDCMP(al#(), N, INDX%(), p)
调用函数,就出现错误,说是INDX%()类型不匹配,这个是什么原因啊,我定义的了。
Sub Gauss_Elimation(a#(), b#())
Dim N As Integer '方程的维数
Dim i As Integer
Dim j As Integer
Dim l As Integer
ReDim al(1 To NNVariable% * TotalNode%, 1 To NNVariable% * TotalNode%) As Double
ReDim x(1 To NNVariable% * TotalNode%) As Double
Dim p As Integer
ReDim INDX(1 To NNVariable% * TotalNode%) As Integer
N = UBound(a#, 1)
For i = 1 To N
For j = 1 To N
al(i, j) = a(i, j)
Next j
Next i
Call LUDCMP(al#(), N, INDX%(), p)
For l = 1 To N
x(l) = b(l)
Next l
Call LUBKSB(al#(), N, INDX%(), x#())
End Sub
Sub LUDCMP(a#(), N, INDX%(), d)
Dim nmax As Double
Dim tiny As Double
Dim aamax As Double
ReDim VV(1 To NNVariable% * TotalNode%) As Double
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim sum As Double
Dim dum As Double
Dim imax As Integer 展开
3个回答
展开全部
把LUDCMP的定义贴出来看看。
——————————
你还是没有把LUDCMP的定义贴出来啊。
我估计是你的LUDCMP过程参数写得有问题。
Sub LUDCMP(A(), N, INDX(), D)
如果你像上面那么写就肯定有问题
你要把类型指定清楚:
Sub LUDCMP(A() as Double, N as Integer, INDX() as Integer, D as Integer)
--------------------------
哦,你那样定义的啊。
我发现貌似是你的一个输入错误:
Call LUDCMP(al#(), N, INDX%(), p)
这里的al#没有定义。。。综观你的整个函数,没找到al的定义,是你不小心把a#()打成al#()了吗?
--
另外建议楼主以后所有变量在定义时都明确指明类型以减少出错的几率。
还有就是INDX%()这种写法已经不推荐了,应该用INDX() As Integer。其它的依此类推。。
——————————
你还是没有把LUDCMP的定义贴出来啊。
我估计是你的LUDCMP过程参数写得有问题。
Sub LUDCMP(A(), N, INDX(), D)
如果你像上面那么写就肯定有问题
你要把类型指定清楚:
Sub LUDCMP(A() as Double, N as Integer, INDX() as Integer, D as Integer)
--------------------------
哦,你那样定义的啊。
我发现貌似是你的一个输入错误:
Call LUDCMP(al#(), N, INDX%(), p)
这里的al#没有定义。。。综观你的整个函数,没找到al的定义,是你不小心把a#()打成al#()了吗?
--
另外建议楼主以后所有变量在定义时都明确指明类型以减少出错的几率。
还有就是INDX%()这种写法已经不推荐了,应该用INDX() As Integer。其它的依此类推。。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询