Write float array into a binary file c#

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?

Jon Skeet
people
quotationmark

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.

people

See more on this question at Stackoverflow