actually i'm working on a code that reads a text (message) and another text (cover), and i have converted (message) to Binary and the process is to check (message); if message = 0 go to (cover) to the first word and take the first character and put it in an array else ( 1 ) take the last character and then go to the second bit in (message) and see the second word in (cover) and so on if the word has the same start and end, eliminate it. i have problems with nested for loops which has if statements inside, the code
fid = fopen('message.txt','r');
Data=fread(fid);
text=char(Data);
fclose(fid);
disp(text);
bin=dec2bin(Data);
disp(bin);
fid = fopen('cover.txt','r');
cover=fread(fid);
Char=char(cover);
fclose(fid);
n=0;
row=size(bin,1);
col=size(bin,2);
A=zeros(24,1);
new = textread('cover.txt', '%s', 'delimiter', ' ');
[r,c]=size(new);
for k=1:1:r
q= new{r,1};
n=num2cell(q);
[cr,cc]=size(n);
for u=1:1:cc
for i=1:1:row
for j=1:1:col
x=bin(i,j);
h = str2double(x);
y=bi2de(h);
if y==1
Z(i,j)=n(1,cc);
else
Z(i,j)=n(1,1);
end
end
end
end
end
Thank you