- ©«¤l
- 1018
- ¥DÃD
- 15
- ºëµØ
- 0
- ¿n¤À
- 1058
- ÂI¦W
- 0
- §@·~¨t²Î
- win7 32bit
- ³nÅ骩¥»
- Office 2016 64-bit
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ®ç¶é
- µù¥U®É¶¡
- 2012-5-9
- ³Ì«áµn¿ý
- 2022-9-28
|
¦^´_ 1# PKKO
´N¬O¶]°j°é°Ú...¦³Ô£²z¥Ñ¤£¯à¶]°j°é
¦pªG·|°õ¦æ«Ü¦h¦¸³oºØ¹Bºâ¡A´N¥]¦¨Function- '¤Gºû¯x°}°µAND
- Function MatrixAND2D(matrix1, matrix2)
- If LBound(matrix1) <> LBound(matrix2) Or _
- UBound(matrix1) <> UBound(matrix2) Or _
- LBound(matrix1, 2) <> LBound(matrix2, 2) Or _
- UBound(matrix1, 2) <> UBound(matrix2, 2) Then
- Err.Raise vbObjectError + 9999, "MatrixAND()", "¨â¯x°}¤W¤U¼Ð¤£¦P"
- End If
-
- Dim arResult, r, c
- ReDim arResult(LBound(matrix1) To UBound(matrix1), LBound(matrix1, 2) To UBound(matrix1, 2)) As Boolean
- For r = LBound(matrix1) To UBound(matrix1)
- For c = LBound(matrix1, 2) To UBound(matrix1, 2)
- arResult(r, c) = matrix1(r, c) And matrix2(r, c)
- Next
- Next
- MatrixAND2D = arResult
- End Function
- Sub test()
- Dim a(1 To 2, 1 To 2) As Boolean, b(1 To 2, 1 To 2) As Boolean
- Dim c
-
- a(1, 1) = True: a(1, 2) = True: b(1, 1) = True
- c = MatrixAND2D(a, b)
- [a1].Resize(2, 2) = c
- End Sub
½Æ»s¥N½X |
|