• Advertisement
Sign in to follow this  

Getting data from a numpy array to c++

This topic is 1235 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