Write Image to Binary File
This example shows how to write an image data to a binary file in a custom format using the
Open the Simulink model.
modelname = 'ex_blkwritebinaryfile.slx'; open_system(modelname);
The input to the model is a RGB color image. The model coverts the color image to grayscale using the
Conversion block. The
Conversion parameter of
Conversion block is set to
intensity. The output binary file name is specified in the
name parameter of the
File block as
outputimage.bin. The parameters of the
File block are configured so the block outputs a custom binary file.
Simulate the model.
The model outputs a binary file named
outputimage.bin to the MATLAB workspace. You can read this binary file using the