How to get float array from the function fann_run()
This the C version of it.
fann_type *calc_out;
fann_type input[2];
struct fann *ann = fann_create_from_file("xor_float.net");
input[0] = -1;
input[1] = 1;
calc_out = fann_run(ann, input);
printf("xor test (%f,%f) -> %f\n", input[0], input[1], calc_out[0]);
fann_destroy(ann);
I am trying to this in c#
[DllImport("fannfloat.dll", EntryPoint = "fann_run")]
public static extern IntPtr fann_run(IntPtr _ann, float[] _input);
IntPtr ann = FANN.fann_create_from_file("Arial.net");
IntPtr result = FANN.fann_run(ann,input600);
Now i want to access the floats using ‘result’.
How can i do this ?
You can use the Marshal.Copy Method to copy the values from unmanaged memory into a managed array if you know the number of elements:
Don’t forget to free
resultwhen you’re done.