Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

TransposeMatrix - Rotate a bi-dimensional array
[ All Languages » VB »  Arrays]

Total Hit ( 2247)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 



Click here to copy the following block
' evaluate the transposed matrix
'
' a transposed matrix is the array you get when
' you "rotate" a bi-dimensional array

Function TransposeMatrix(arr() As Double) As Double()
  Dim startRow As Long, startCol As Long
  Dim endRow As Long, endCol As Long
  Dim r As Long, c As Long
  Dim tmp As Double
  
  ' get size of original matrix
  startRow = LBound(arr)
  endRow = UBound(arr)
  startCol = LBound(arr, 2)
  endCol = UBound(arr, 2)
  ' prepare the result matrix
  ReDim res(startCol To endCol, startRow To endRow) As Double
  
  ' transpose the matrix
  For r = startRow To endRow
    For c = startCol To endCol
      res(c, r) = arr(r, c)
    Next
  Next
  
  ' return the transposed result
  TransposeMatrix = res

End Function


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.