is anybody who know how I can do this?

Discussion in 'MATLAB' started by Ciprian Hoost, May 11, 2005.

  1. I have text file(or a .m file like I showed in the exemple) and I
    have also a matlab program in wich like input,data I use this text
    file...is a encryption..and I want to encrypt this file
    my program work with binary values 0 and 1 ..so for me I have to
    transform this text file in a binary one..
    Does anybody know how I can do that?
    I already found how I could transfer in Ascii code ..like this....
    f1=fopen('tx.m','r');
    f2=fread(f1); % tx.m is the plaintext that we want to encrypt;
    P1=setstr(f2');
    N_c=length(P1);
    for j=1:1:N_c
    a=dec2bin(P1(j));
    b=bin2dec(a);
    P1_d(j)=b;
    % in P1_d we have the Ascii values of the plaintext;
    end;;

    but....I need to transform in a binary vector....
    thank you very much !!
     
    Ciprian Hoost, May 11, 2005
    #1
    1. Advertisements

  2. Ciprian Hoost

    Stefan Guest

    Hi Ciprian Hoost,

    I'm sorry, but your writing style is that annoying that I'm not
    committed to read it at all.

    Regards,
    Stefan
     
    Stefan, May 11, 2005
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.