| | |
Matlab problem
Please support our Legacy and Other Languages advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: May 2007
Posts: 52
Reputation:
Solved Threads: 0
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
Any help ? Please
Thank you
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;
endAny help ? Please
Thank you
![]() |
Similar Threads
- launching a wxpython gui from matlab (Python)
- MatLab Forum? (DaniWeb Community Feedback)
- MATLAB Problem (Legacy and Other Languages)
- Tough Matlab problem...Help!!! (Legacy and Other Languages)
- Problem when passing arrays from c# to matlab (C#)
- Link problem when using matlab engine in C++ project in Mac Os with gcc (C++)
- Matlab - Is this a floating point arithmetic problem? (Computer Science)
- Matlab Help (Computer Science)
- problem with MATLAB loop (Legacy and Other Languages)
Other Threads in the Legacy and Other Languages Forum
- Previous Thread: Help With Scheme Procedure
- Next Thread: matlab problem, help me experts plz
| Thread Tools | Search this Thread |





