bin_state.m
上传用户:hnyfjx
上传日期:2013-06-30
资源大小:2149k
文件大小:0k
源码类别:

传真(Fax)编程

开发平台:

Matlab

  1. function bin_state = bin_state( int_state, m )
  2. % Copyright Matt C. Valenti
  3. % MPRG lab, Virginia Tech
  4. % for academic use only
  5. % converts an vector of integer into a matrix; the i-th row is the binary form 
  6. % of m bits for the i-th integer
  7. for j = 1:length( int_state )
  8.    for i = m:-1:1
  9.        state(j,m-i+1) = fix( int_state(j)/ (2^(i-1)) );
  10.        int_state(j) = int_state(j) - state(j,m-i+1)*2^(i-1);
  11.    end
  12. end
  13. bin_state = state;