Jump to content
  • Advertisement
Sign in to follow this  
.chicken

Getting data from a numpy array to c++

This topic is 1417 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!