Skip to main content
edited tags
Link
martineau
  • 124k
  • 29
  • 180
  • 319

Reading ina binary file into 2d2D array python

I am having trouble reading in a binary file in python and plotting it. itIt is supposedly a unformatedan unformatted binary file representing a 1000x1000 array of integers. I have used:

image = open("file.dat", "r")
a = np.fromfile(image, dtype=np.uint32) 

but printingPrinting the length only says itsreturns 500000 and i. I cannot figure out how to create a 2d2D array out of it as well.

thanks for the help.

Reading in binary file into 2d array python

I am having trouble reading in a binary file in python and plotting it. it is supposedly a unformated binary file representing a 1000x1000 array of integers. I have used:

image = open("file.dat", "r")
a = np.fromfile(image, dtype=np.uint32) 

but printing the length only says its 500000 and i cannot figure out how to create a 2d array out of it as well.

thanks for the help.

Reading a binary file into 2D array python

I am having trouble reading a binary file in python and plotting it. It is supposedly an unformatted binary file representing a 1000x1000 array of integers. I have used:

image = open("file.dat", "r")
a = np.fromfile(image, dtype=np.uint32)

Printing the length returns 500000. I cannot figure out how to create a 2D array out of it.

Source Link
swisswilson
  • 61
  • 1
  • 2
  • 5

Reading in binary file into 2d array python

I am having trouble reading in a binary file in python and plotting it. it is supposedly a unformated binary file representing a 1000x1000 array of integers. I have used:

image = open("file.dat", "r")
a = np.fromfile(image, dtype=np.uint32) 

but printing the length only says its 500000 and i cannot figure out how to create a 2d array out of it as well.

thanks for the help.