I have a float array :
float[] samples32array
I need to convert it into a binary file so I can read it in matlab.
Is there any way to do that?
You can use BinaryWriter
to write the data to a file very easily:
foreach (var value in samples32array)
{
writer.Write(value);
}
Now BinaryWriter
is guaranteed to use little-endian format, so in your Matlab call, you should specify a machinefmt
value of l
to explicitly read it in little-endian format too.
See more on this question at Stackoverflow