clear, clca = [0 1 0 0 0 0 0 1];b = [0 0 1 1 0 0 1 1];c = xor(a,b);%Write encoded message to a text file
fid = fopen('mycode.txt','w'); %Opens the file for write access
fwrite(fid,c);fclose(fid);disp(c);%%
%Read and decode the encoded message from a text file
fid = fopen('mycode.txt','r'); %Open the file for read access
c = fread(fid);fclose(fid);a = xor(c,b);disp(a);
I'm not sure why the code isn't displaying the decoded message, which should be [0 1 0 0 0 0 0 1]
Best Answer