Main Content

Import Image From MATLAB Workspace

This example shows how to import an image from MATLAB to Simulink workspace using Image From Workspace block.

Load a .mat file containing the image to import from MATLAB workspace. The image is stored in the variable Im. Set the Value parameter of the Image From Workspace block to the variable in MATLAB workspace.

load('inputimage.mat')

Open the Simulink model.

open_system('ex_blkimagefromworkspace.slx');

Run the model. The model exports the image to the Simulink workspace and displays the output image.

sim('ex_blkimagefromworkspace.slx');