Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

binary to ascii

Name: Anonymous 2011-09-20 22:26

total programming noob here, would really appreciate if someone here can help me with this. i would like to manipulate the parameter file from my simulation program, unfortunately the proprietary program saves some of the parameter files as ascii (which is great), but others as binary files which "contain a huge amount of sequential double-precision fields" (according to the manual). the file looks something like this:

File Version: 2.27   LLG Version: 2.6.33 (17 Oct 2009)                            ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@      ‰@     

i'm wondering if there're any simple programs on windows out there that allow me to convert something that this to ascii and then back, as i want to read it into say matlab and play around with the parameters. maybe some kind of binary of hex editor that can do "save as"? thanks.

Name: Anonymous 2011-09-21 0:29

whats the file extension type?

Name: Anonymous 2011-09-21 1:43

Read SICP.

Name: Anonymous 2011-09-21 2:54

print "$_\n" for unpack "d*", $data

Name: Anonymous 2011-09-21 3:58

"whats the file extension type?"

it's a special file defined by the program, something only those who use the simulation package would know.

it's a finite element simulation package and the parameters of each element of the simulated array are stored sequentially as far as i know.

i've found a really dumb way of changing the parameters over the past couple of hours, and that involves figuring out the file structure and the location of the parameters i want to change by saving the parameter file, changing a bunch of parameters in the program, saving a 2nd copy and looking for differences in a hex editor.

i found the memory range of the parameters, as well as the fact that they're stored as converted double precision numbers in hexadecimal. by importing the hex file as a matrix into matlab i can now change the parameters, but somehow i feel this is fucking stupid and there're better ways.

"print "$_\n" for unpack "d*", $data"

no idea wtf you mean. i'm a total fucking noob, i do for and while loops and basic string manipulations in matlab, that's it.

Name: Anonymous 2011-09-21 4:03

>>5
that's perl

Name: Anonymous 2011-09-22 10:29

xcbvgf

Don't change these.
Name: Email:
Entire Thread Thread List