Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. normalize[file_] :=
  2. Module[{mtfile = OpenRead[file, BinaryFormat -> True], data, Mat},
  3. SetStreamPosition[mtfile, 0];
  4. data = Partition[BinaryReadList[mtfile, "Real32", ByteOrdering -> 1],1297];
  5. Close[mtfile];
  6. Mat = Join[data[[All, ;; 45]], Transpose[Standardize /@ Transpose[data[[All, 46 ;; 47]]]], data[[All, 48 ;;]], 2];
  7. BinaryWrite[file, Flatten@Mat, "Real32", ByteOrdering -> 1];];
  8.  
  9. FileByteCount["00010005.dat"]/2^10.
  10. (*891.688*)
  11.  
  12. normalize["00010005.dat"];
  13.  
  14. FileByteCount["00010005.dat"]/2^10.
  15. (*8025.19*)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement