Function MatrixPaint(w, d, ByVal m As Variant, a, n, ByVal msg As String) As String Dim e() As String ReDim e(1 To d) As String d = Len(a) q = "| " h = "|_____|" l = vbCrLf For i = (w - 1) To d If i = (w - 1) Then t = t & l & "." t = t & "_____." If i = d Then t = t & l & "| " & n & " | " Next i For i = w To d e(i) = Mid(a, i, 1) t = t & e(i) & " | " h = h & "_____|" Next i t = t & l & h & l For i = w To d For j = w To d v = Round(m(i, j), 2) u = Mid(q, 1, Len(q) - Len(v)) If j = d Then o = "|" Else o = "" For b = w To d If j = w And i = b Then t = t & "| " & e(i) & " " End If Next b t = t & u & v & o Next j t = t & l & h & l Next i MatrixPaint = msg & " M[" & Val(d - w + 1) & "," & Val(d - w + 1) & "]" & l & t & l End Function
Monday, December 7, 2020
See matrix content in pure ASCII: Show an array content in the console !
Source: Gagniuc, Paul A. (2017). Markov Chains: From Theory to Implementation and Experimentation. USA, NJ: John Wiley & Sons. pp. 1–235. ISBN 978-1-119-38755-8.
Subscribe to:
Post Comments (Atom)
Sample input or output...
ReplyDeleteGreat Work
ReplyDelete