ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¦p¦ó¨Ï¥Î°}¦C¤ñ¹ï¥æ¶°ªºµ{¦¡½X?

¦^´_ 1# PKKO
´N¬O¶]°j°é°Ú...¦³Ô£²z¥Ñ¤£¯à¶]°j°é
¦pªG·|°õ¦æ«Ü¦h¦¸³oºØ¹Bºâ¡A´N¥]¦¨Function
  1. '¤Gºû¯x°}°µAND
  2. Function MatrixAND2D(matrix1, matrix2)
  3.     If LBound(matrix1) <> LBound(matrix2) Or _
  4.         UBound(matrix1) <> UBound(matrix2) Or _
  5.         LBound(matrix1, 2) <> LBound(matrix2, 2) Or _
  6.         UBound(matrix1, 2) <> UBound(matrix2, 2) Then
  7.         Err.Raise vbObjectError + 9999, "MatrixAND()", "¨â¯x°}¤W¤U¼Ð¤£¦P"
  8.     End If
  9.    
  10.     Dim arResult, r, c
  11.     ReDim arResult(LBound(matrix1) To UBound(matrix1), LBound(matrix1, 2) To UBound(matrix1, 2)) As Boolean
  12.     For r = LBound(matrix1) To UBound(matrix1)
  13.         For c = LBound(matrix1, 2) To UBound(matrix1, 2)
  14.             arResult(r, c) = matrix1(r, c) And matrix2(r, c)
  15.         Next
  16.     Next
  17.     MatrixAND2D = arResult
  18. End Function

  19. Sub test()
  20.     Dim a(1 To 2, 1 To 2) As Boolean, b(1 To 2, 1 To 2) As Boolean
  21.     Dim c
  22.    
  23.     a(1, 1) = True: a(1, 2) = True: b(1, 1) = True
  24.     c = MatrixAND2D(a, b)
  25.     [a1].Resize(2, 2) = c
  26. End Sub
½Æ»s¥N½X
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

        ÀR«ä¦Û¦b : ¦Y­W¤F­W¡B­WºÉ¤Ü¨Ó¡A¨ÉºÖ¤FºÖ¡BºÖºÉ´d¨Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD