Hi
I want a code in matlab that make this ascci code
1110101
1110010
1100010
1001110
As this
1110101111001011000101001110
In other mean I want to convert this acsii code form Vertical
to Horizontal
then I want to change the state of one bit every 8 bit
"1 >>0 and 0>>1"
As this
1110101011001010000101011110
I wrote the code, but it is not the efficient code. It will serve for your purpose. Important thing is you need to use num2str operation in Matlab.
Matlab Code: load Code.txt
for m=1:4
arr(m)= Code(m,;
end
for n=1:7:28
if ((n >= 1)&& (n<8)) k=1;
end
if ((n >= 8)&&(n<15)) k=2;end
if ((n >= 15)&& (n<22)) k=3; end
if (n >= 22) k=4;end
d(n:n+6)=num2str(arr(k));
end
for p=1:28
if (mod(p,8)==0)
if (d(p)== '0')
dmod(p)='1';
else
dmod(p)='0';
end
end
if (mod(p,8)~=0)
dmod(p)=d(p);
end
end
OUTPUT:
Code
Code =
1110101
1110010
1100010
1001110
>> d
d =
1110101111001011000101001110
>> dmod
dmod =
1110101011001010000101011110
---------- Post added at 23:51 ---------- Previous post was at 23:43 ----------
Replace the second for-loop with following code: for n=1:7:28
d(n:n+6)=num2str(arr(1+int8(n/8)));
end