# Search the Community

Showing results for tags 'linalg'.

• ### Search By Tags

Type tags separated by commas.

### Forums

• General
• Announcements and Site News
• AutoIt v3
• AutoIt Help and Support
• AutoIt Technical Discussion
• AutoIt Example Scripts
• Scripting and Development
• Developer General Discussion
• Language Specific Discussion
• Operating System Deployment
• Windows Client
• Windows Server
• Office

### Categories

• AutoIt Team
• Beta
• MVP
• AutoIt
• Automation
• Databases and web connections
• Data compression
• Encryption and hash
• Games
• Hardware
• Information gathering
• Internet protocol suite
• Maths
• Media
• PDF
• Security
• Social Media and other Website API
• Windows
• Scripting and Development
• Operating System Deployment
• Windows Client
• Windows Server
• Office

• Forum FAQ
• AutoIt

### Calendars

• Community Calendar

• 0 Replies

• 0 Reviews

• 0 Views

Found 1 result

1. ## Matrix Generate Script

Hi there! I have been learning linear algebra in my university for months. The subject was rather hard, I did't understand it much so I sent a email to my teacher to ask him. But I realized that typing a matrix by text was extremely hard. I don't want to make a LaTex function, save to a file, attach it to the mail, bla bla bla!!! It's complicated! So I spent 2 hours yesterday to make this tool. Just type the number of lines and columns and matrix values, it will generate a quite nice matrix in ASCII characters Enjoy! Notes: It will rearrage your numbers to straight columns. 1x1 will cause error. ConsoleWrite (@CRLF & '------------------------------------MATRIX TEST-----------------------------------------' &@CRLF) Dim \$c = 6;column Dim \$l = 4;line Dim \$n = '1,6,2,4,b,a,7,6,6,0,44,4,6,3,6,2,6,8,9,6,6,1,2,logmein' \$split = StringSplit (\$n,',') If \$c * \$l <> \$split[0] Then ConsoleWrite ('! Matrix values number do not match the columns and lines !' & @CRLF) Exit EndIf Dim \$char[\$l][\$c], \$len[\$l][\$c], \$maxlen[\$c][3] For \$i = 0 To \$l-1 For \$u = 0 To \$c -1 \$v = \$i*(\$c) + \$u +1 \$char[\$i][\$u] = \$split[\$v] \$len[\$i][\$u] = StringLen (\$split[\$v]) If \$len[\$i][\$u] > \$maxlen[\$u][0] Then \$maxlen[\$u][0] = \$len[\$i][\$u] \$maxlen[\$u][1] = \$i \$maxlen[\$u][2] = \$u EndIf Next Next Local \$finallen For \$u = 0 To \$c - 1 \$finallen += \$maxlen[\$u][0] Next ConsoleWrite (' _' & _Repeat(' ',\$finallen + \$c) & '_' & @CRLF) For \$i = 0 To \$l-1;write lines For \$u = 0 To \$c-1;write columns \$v = \$i*(\$c) + \$u +1 \$char[\$i][\$u] = \$split[\$v] Switch \$u Case 0; the first column If StringLen (\$char[\$i][\$u])<\$maxlen[\$u][0] Then ConsoleWrite ('| ' & \$char[\$i][\$u] & _Repeat(' ', \$maxlen[\$u][0]-StringLen (\$char[\$i][\$u])+1)) Else ConsoleWrite ('| ' & \$char[\$i][\$u] & ' ') EndIf Case 1 To \$c-2 ;middle columns If \$i > 0 Then If StringLen (\$char[\$i][\$u]) < \$maxlen[\$u][0] Then ConsoleWrite (\$char[\$i][\$u] & _Repeat(' ', \$maxlen[\$u][0]-StringLen (\$char[\$i][\$u])+1)) Else ConsoleWrite (\$char[\$i][\$u] & ' ' ) EndIf Else If StringLen (\$char[\$i][\$u]) < \$maxlen[\$u][0] Then ConsoleWrite (\$char[\$i][\$u] & _Repeat(' ', \$maxlen[\$u][0]-StringLen (\$char[\$i][\$u])+1)) Else ConsoleWrite (\$char[\$i][\$u] & ' ' ) EndIf EndIf Case Else ; the last column If StringLen (\$char[\$i][\$u])<\$maxlen[\$u][0] Then ConsoleWrite (\$char[\$i][\$u] & _Repeat(' ', \$maxlen[\$u][0]-StringLen (\$char[\$i][\$u])+1) & ' |' & @CRLF) Else ConsoleWrite (\$char[\$i][\$u] & ' |' & @CRLF) EndIf EndSwitch Next Next ConsoleWrite ('|_' & _Repeat(' ',\$finallen + \$c ) & '_|' & @CRLF) Func _Repeat(\$chars, \$times);repeat a character in a specified time Local \$rChar For \$a = 1 To \$times \$rChar &= \$chars Next Return \$rChar EndFunc ;==>_Repeat
×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...