MATLAB: Convert an Image to a binary (.bin) file

.binbinary fileconvert image to binary fileimageImage Processing Toolbox

Hello
I am trying to convert an image to a binary file (not binary image) for further processing in another software. I have tried the following code but does not seems to work as the file I am creating is zero bytes !
I= imread('cameraman.bin','w')
fid=fopen ('cameraman.bin','w');
fwrite(fid,I,'float32');
Can someone advice me on how to do this correctly ?
Thank you

Best Answer

As far as I know there is no defined format for .bin. It's like .raw - you can basically define it however you want. You need to find out what format that other software package wants.