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

¯x°}¦X¨Ö

¯x°}¦X¨Ö

§Ú¦³¼Æ­Ó¯x°}
Ex:
HdB(12,1)
MdB(12,1)...¦@¦³8­Ó ¸Ó¦p¦ó±N¥L­Ì²Õ¦X¦¨¤@­Ó12*8ªº¯x°}?
·s¯x°}A(12,8)

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2013-1-2 16:27 ½s¿è

¦^´_ 1# acdx
¦n¹³¨S¤°»ò²«K¤èªk , °²³]§Aªºarray¤U­­³£¬°1
1.ª½±µ´£¨ú¤¸¯À
  1. Dim ar, i
  2. ReDim ar(1 To 12, 1 To 8)
  3. For i = 1 To 12
  4.     ar(i, 1) = HdB(i, 1)
  5.     ar(i, 2) = MdB(i, 1)
  6.     'ar(i, 3) = ....
  7.     '....
  8.     'ar(i, 8) = ....
  9. Next i
½Æ»s¥N½X
2.§Q¥Î¤u§@ªí(·Pı®¼®ö¶O)
  1. Dim ar
  2. With Workbooks.Add
  3.     With .Sheets(1)
  4.         .[A1].Resize(12) = HdB
  5.         .[A1].Resize(12).Offset(, 1) = MdB
  6.         '.[A1].Resize(12).Offset(, 2) = ...
  7.         '...
  8.         '.[A1].Resize(12).Offset(, 7) = ...
  9.         ar = .[A1].Resize(12, 8)
  10.     End With
  11.     .Close savechanges:=False
  12. End With
½Æ»s¥N½X
3. §ï¥ÎEvaluate/Join (°}¦C¤¸¯À¤£§t³r¸¹©Î¤À¸¹¦r¤¸®É¤~¥i¥Î)
  1. Dim ar
  2. ar = Application.Transpose(Evaluate("{" & _
  3.          Join(Application.Transpose(HdB), ",") & ";" & _
  4.          Join(Application.Transpose(MdB), ",") & _
  5.          "}"))
½Æ»s¥N½X

TOP

¦^´_ 1# acdx
¥H¥|°}¦C¬°¨Ò
  1. Sub ex()
  2. Dim AHW(12), BHW(12), CHW(12), DHW(12), TAry, MyAry()
  3. For i = 0 To 11  '¼g¤J4­Ó¤@ºû°}¦Cªº­È
  4.   AHW(i) = Int((100 * Rnd) + 1)
  5.   BHW(i) = Int((100 * Rnd) + 1)
  6.   CHW(i) = Int((100 * Rnd) + 1)
  7.   DHW(i) = Int((100 * Rnd) + 1)
  8. Next
  9. TAry = Array(AHW, BHW, CHW, DHW)  '¦X¨Ö¥|­Ó¤@ºû°}¦C
  10. MyAry = Application.Transpose(Application.Transpose(TAry))  '±N¤@ºû°}¦CÂন¥¿½T¤Gºû°}¦C
  11. [A1].Resize(4, 12) = MyAry  '±N¤Gºû°}¦C¼g¤J¤u§@ªí
  12. For i = 1 To 4
  13.    For j = 1 To 12
  14.      MsgBox MyAry(i, j)  '¨ú¥X¤Gºû°}¦Cªº­È
  15.    Next
  16. Next
  17. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 3# Hsieh
ÁÙ¬Oª©¥Dªº¤èªk²¼ä ,
­ì¨Ó²Ä10¦ætranspose¨â¦¸ÁÙ¦³³oºØ®ÄªG:
¤@ºû°}¦Cªº¤@ºû°}¦C(Arr(m)(n))Âà¤Gºû(Arr(m,n))

TOP

        ÀR«ä¦Û¦b : ¬°¦Û¤v§äÂǤfªº¤H¥Ã»·¤£·|¶i¨B¡C
ªð¦^¦Cªí ¤W¤@¥DÃD