Created
October 1, 2020 16:11
-
-
Save glegrain/b2ad2e2f4d3e98bab36fef6e502d9e35 to your computer and use it in GitHub Desktop.
Numpy array to C file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import subprocess | |
my_data = np.array([0, 0.1, 0.2, 0.3], dtype=np.float32) | |
np.array(my_data).tofile('my_data.bin') | |
subprocess.run(["xxd", "-i", "my_data.bin", "my_data.h"], capture_output=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment