📄 模糊识别f2.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmCalc
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "模糊识别"
ClientHeight = 9720
ClientLeft = 60
ClientTop = 345
ClientWidth = 12105
LinkTopic = "Form1"
ScaleHeight = 9720
ScaleWidth = 12105
Begin VB.CommandButton cmdResult
Caption = "继续"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2040
TabIndex = 4
Top = 0
Width = 855
End
Begin VB.CommandButton cmdEqua
Caption = "等价"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
TabIndex = 3
Top = 0
Width = 810
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 8295
Left = 0
TabIndex = 2
Top = 360
Width = 12015
_ExtentX = 21193
_ExtentY = 14631
_Version = 393216
BackColorFixed = -2147483639
BackColorBkg = 16777215
AllowUserResizing= 3
End
Begin VB.CommandButton cmdExit
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 0
TabIndex = 1
Top = 0
Width = 735
End
Begin VB.CommandButton cmdSimu
Caption = "相似"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 720
TabIndex = 0
Top = 0
Width = 615
End
End
Attribute VB_Name = "frmCalc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'模糊识别
'计算窗体模块
Option Explicit
Dim intI As Integer, intJ As Integer, intR As Integer
Private Sub Form_Load()
'MSFlexGrid1.Rows-1为网格总行数和列数
MSFlexGrid1.Rows = intRow + 1
MSFlexGrid1.Cols = intRow + 1
MSFlexGrid1.Visible = False
cmdEqua.Visible = False: cmdResult.Visible = False
End Sub
'求相似矩阵
Private Sub cmdSimu_Click()
Dim intC As Integer
On Error Resume Next
'建立模糊相似矩阵(标定)
If Opt(1) Then M1 X, R, dbM '数量积
If Opt(2) Then M2 X, R '夹角余弦
If Opt(3) Then M3 X, R '相关系数
If Opt(4) Then M4 X, R '指数相似系数
If Opt(5) Then M5 X, R '最大最小
If Opt(6) Then M6 X, R '算术平均最小
If Opt(7) Then M7 X, R '几何平均最小
If Opt(8) Then M8 X, R, dbM '绝对值倒数
If Opt(9) Then M9 X, R '绝对值指数
If Opt(11) Then M11 X, R, dbC '海明距离
If Opt(12) Then M12 X, R, dbC '欧氏距离
If Opt(13) Then M13 X, R, dbC '切氏距离
If Opt(15) Then M14 X, R, dbC '海明加权
'Opt(14)=1是直接使用原始数据作为相似矩阵
If Opt(14) = 1 Then
For intI = 1 To intRow
For intJ = 1 To intRow
R(intI, intJ) = X(intI, intJ)
Next intJ
Next intI
End If
'检查R是否符合相似矩阵的要求
intC = CheckR(R)
If intC = 0 Then '矩阵不满足相似要求
If Opt(14) = 1 Then MsgBox "输入数据错误", , "矩阵不满足相似性"
If Opt(14) <> 1 Then MsgBox "提供参数(M或C)错误", , "矩阵不满足相似性"
End
End If
MSFlexGrid1.Visible = True
'利用网格显示相似矩阵
'显示数据
For intI = 1 To intRow
MSFlexGrid1.Row = intI
For intJ = 1 To intRow
MSFlexGrid1.Col = intJ
MSFlexGrid1.Text = R(intI, intJ)
Next intJ
Next intI
'显示上部标签
MSFlexGrid1.Row = 0
For intI = 1 To intRow
MSFlexGrid1.Col = intI
MSFlexGrid1.Text = "R" & intI
Next intI
'显示左边标签
MSFlexGrid1.Col = 0
For intI = 1 To intRow
MSFlexGrid1.Row = intI
MSFlexGrid1.Text = "R" & intI
Next intI
cmdSimu.Visible = False: cmdEqua.Visible = True
End Sub
'求等价矩阵
Private Sub cmdEqua_Click()
'计算传递闭包
tR R, RR
'利用网格显示等价矩阵
'显示数据
For intI = 1 To intRow
MSFlexGrid1.Row = intI
For intJ = 1 To intRow
MSFlexGrid1.Col = intJ
MSFlexGrid1.Text = R(intI, intJ)
Next intJ
Next intI
cmdEqua.Visible = False: cmdResult.Visible = True
End Sub
'继续
Private Sub cmdResult_Click()
Unload Me
frmResult.Visible = True
End Sub
'退出
Private Sub cmdExit_Click()
Unload Me
frmFile.Visible = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -