944,092 Members | Top Members by Rank

Ad:
Aug 23rd, 2009
-1

Matlab problem

Expand Post »
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
Similar Threads
Reputation Points: 14
Solved Threads: 0
Junior Poster
bufospro is offline Offline
140 posts
since May 2007
Oct 27th, 2009
0

matlab problem, help me experts plz

it is hard
Last edited by aabbddlah; Oct 27th, 2009 at 5:58 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
aabbddlah is offline Offline
3 posts
since Oct 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Legacy and Other Languages Forum Timeline: Help With Scheme Procedure
Next Thread in Legacy and Other Languages Forum Timeline: matlab problem, help me experts plz





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC