Relevent to Gui:Acess elements in a result obtained,Conveting from binary to decimal
    5 views (last 30 days)
  
       Show older comments
    
Question1:
I have a gui which basically does an encryption using AES encryption as follows.
ptext='TRANSFER ONE MILLION DOLLARS FROM STOCKS TO BONDS';
key='AES KEYS ARE SECURE';
ctext=aesencipher(ptext,key,Sbx,f(x),x)
Please don't worry about the above commands. It works out alright in my actual code in the gui. But my problem is as the result of ctext I will obtain something as shown below and then is it possible to access each of its elements as if in a matrix. Usual way to access matrix elements , i.e ctext(2,3) when you need the 3rd element of 2nd row , does not work here. Is there another method ?
ctext=
 Columns 1 through 15
      40   160   254   160   157    64   227    62   199   221   215   116    34   164    99
      65     1   106   251   129    88   115   108    52    13    39   208   218   190   132
      82    28   245   229    60   190   131   229    61   232    15   173     5    91    10
    Column 16
     129
     111
     210
Question2:
A=[56 4 31 5];
how to convert the elements in the above array to binary and store in an array and then again convert to decimal array?
Also is there a way to construct an array where each entry in the above array repeats 3 times. i.e my resulting array should be as
Result=[56 56 56 4 4 4 31 31 31 5 5 5];
Please help me with these two problems
Thanks a lot in advance.
1 Comment
Answers (1)
  Walter Roberson
      
      
 on 28 Dec 2015
        
      Edited: Walter Roberson
      
      
 on 28 Dec 2015
  
      Answer for #2:
B = dec2bin(A) - '0'
recovered_A = bin2dec(char(B + '0'))
Answer for #3:
A=[56 4 31 5];
kron(A, [1 1 1])
0 Comments
See Also
Categories
				Find more on Introduction to Installation and Licensing in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
