2
$\begingroup$

I am new to Mathematica but I need to use it in order to create my datafile: I need very high precision that a standard C++ code cannot give me easily.

I have a 2D function that I will call myFunction[x_, y_] that is defined on x = [0 ; 4], y = [O ; 2]. This function is working perfectly, but now I need to create a raw file of this 2D function on 1024*1024 pixels encoded on double precision.

This is what I did for the moment:

output = Table[myFunction[i,j],{i,0,4,deltax}, {j,0,2,deltay}]
Export[CloudObject@"output.raw",output, "RAW"]

I got the following errors:

Cannot assign to raw object 1/128

Cannot assign to raw object 0

I am terribly lost, I didn't find any help for the moment on the Internet for this part.

$\endgroup$

1 Answer 1

3
$\begingroup$

You may try this

output = Table[myFunction[i, j], {i, 0, 4, 4/1023}, {j, 0, 2, 2/1023}];
img = Image[output, "Real64", ImageResolution -> 1024] 
Export["output", img, "RawBitmap"]

Set the type option of Image can produce a double-precision image. Notice that Mathematica does not support RAW image export, you can use RawBitmap, or just use BMP.

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.