0

I have files containing floating point numbers in ascii format that I need to convert to binary (.bin) format on a Mac 10.10.3. I am most familiar with Matlab but alternatively could use python or C. I found a program called Ascii converter 1.0 (Mac) written in java but got errors about a nonexistent package when I tried to compile it. It did not come with any associated documentation that would help me to compile and run it properly. I did some google searching but have so far not found a better alternative.

Is there a simple code that would take an input file (vmodel.txt) and output a binary file (vmodel.bin)? Thanks

  • possible duplicate of [Convert string to binary in python](http://stackoverflow.com/questions/18815820/convert-string-to-binary-in-python) – doru Jul 13 '15 at 16:53
  • 2
    What format do you want the output to be in? Do you want IEEE754? Single-precision or double-precision? – saulspatz Jul 13 '15 at 17:26
  • double-precision. However I found a working code in the distribution of seismic unix (a2b.c) which did the job – kristinpalonge Jul 14 '15 at 16:30
  • doru, I saw the post on "Convert string to binary in python", but in this case I did not want a file with the numbers converted to binary (ascii binary with 0's and 1's) but a binary formatted file. Converting the numbers themselves to binary is straightfoward, changing the file format proved to be different – kristinpalonge Jul 14 '15 at 16:35

0 Answers0