Sign in to follow this  
.chicken

Getting data from a numpy array to c++

Recommended Posts

Ok, I got another problem. I have a .npy file containing a numpy array[52][52][52][52].

I need the data from that array in my c++ application.

What is the easiest way to get that?

 

I found

https://github.com/rogersce/cnpy

but I'm unable to make it and keep getting errors..

 

Isn't there a way to simply save the array from within python to another file format? When I use

array = numpy.load("myfile.npy")
savetxt(array, "result.txt")

I get an error, I believe because the format it's loaded to doesn't work with the savetxt function?

 

Thanks in advance.

 

Edit:

Ok, got it solved. I loaded the 4dimensional numpy array, save it to a 1dimensional, by iterating over it, saved that to a .txt and then loaded that in c++ and stored the info back in an array.

Thanks anyway!

Edited by .chicken

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this