Please support our Legacy and Other Languages advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: May 2007
Posts: 52
Reputation: bufospro is an unknown quantity at this point 
Solved Threads: 0
bufospro bufospro is offline Offline
Junior Poster in Training

Matlab problem

 
-1
  #1
Aug 23rd, 2009
Hi all,
I am mew in matlab and I have to read a text and then make a vector with the binary value of their chars.

For example :
text = 'pr'
ascii = 1010000
1110010

I want to make a vector like that -->
[1;0;1;0;0;0;0;1;1;1;0;0;1;0]


My code is

function bits_vector = textbin(text)

text_ascii = uint8(text);
num = length(text_ascii)

bits_matrix = dec2bin(text_ascii,7)-'0';

len_vector = num*8

bits_vector = zeros(len_vector,1)

for i=1:len_vector
    bits_vector(i:(i+7)) = bits_matrix(i,:)
    i=i+8;
end

Any help ? Please

Thank you
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 3
Reputation: aabbddlah is an unknown quantity at this point 
Solved Threads: 0
aabbddlah aabbddlah is offline Offline
Newbie Poster

matlab problem, help me experts plz

 
0
  #2
Oct 27th, 2009
it is hard
Last edited by aabbddlah; Oct 27th, 2009 at 5:58 pm.
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the Legacy and Other Languages Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC