Advertisement
Guest User

Untitled

a guest
Jan 12th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. X = -1.2356
  2.     if X < 0
  3.         array(1) = 1;
  4.     else
  5.         array(1) = 0;
  6.     end
  7.     a = abs(ceil(X));
  8.     A = dec2bin(a,3);
  9.     array(2) = str2double(A(1));
  10.     array(3) = str2double(A(2));
  11.     array(4) = str2double(A(3));
  12.     b = num2str(abs(X));
  13.     c = str2double([b(3) b(4)]);
  14.     d = str2double([b(5) b(6)]);
  15.     if 2*c >100
  16.         array(5) = 1;
  17.     else
  18.         array(5) = 0;
  19.     end
  20.    
  21.     if 2*d >100
  22.         array(6) = 1;
  23.     else
  24.         array(6) = 0;
  25.     end
  26.     array
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement