Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: noahbaby94 on February 24, 2009, 09:44:46 am

Title: Mat to hex
Post by: noahbaby94 on February 24, 2009, 09:44:46 am
Can someone tell me what's wrong with my program it converts a matrix to hex.
Code: [Select]
:"?→Str1
:For(A,1,8
:For(B,1,12
:det(29,[A](A,B
:If 1=length(Ans
:"0"+Ans
:Ans+Str1→Str1
:End:End
:det(17,sub(Ans,2,length(Ans)-1→Str1
I'm executing it with this.
Code: [Select]
:identity(4,Str1,0,0,12,8,0,12,0,8,1,0,8,1,0
Strangely if I do this
Code: [Select]
:identity(4,Str1,0,1,12,8,0,12,0,8,1,0,8,1,0
I get it aligned properly but up one.
Title: Re: Mat to hex
Post by: simplethinker on February 24, 2009, 01:30:18 pm
Where is the problem occurring and what exactly is it?

Using your first code chunk
Code: [Select]
:identity(4,Str1,0,0,12,8,0,12,0,8,1,0,8,1,0I don't get a problem, it will fill the map completely/correctly, but the second (the one you're not having problems with)
Code: [Select]
:identity(4,Str1,0,1,12,8,0,12,0,8,1,0,8,1,0Only tiles the bottom row incompletely.

[edit] You could just use det(26 to convert the matrix to a string and then use det(17 to get the binary string.  For all the matrices I tried they both returned the same string.  Nevermind

[another edit] I think I figured out the problem.  You're going 'backwards'.  You're adding your previous string to the end of the new element, so if you're matrix was [[1,2,3]], your program gives "030201?"