Getting data from a numpy array to c++

Started by
-1 comments, last by .chicken 9 years, 7 months ago

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!

This topic is closed to new replies.

Advertisement