Search code examples
matlabmatlab-guidematlab-deploymentmatlab-compiler

Display blank image after each non-blank image


I want to display a images in a random order but have a blank image displayed after each image. I have the images displaying randomly but not sure how to make sure the blank image displays after each image. Please help!


Solution

  • By the blank image you mean you want to display nothing into the axis. So to do so you may just call the command cla after displaying an image whenever you want to display a blank axis/image. This clears the previous image from the axis and simply shows a blank axis.

    e.g., Suppose you have two images to display and in between you want to display a blank image then the code to do so is.

    % show the first image
    imshow('cameraman.tif')
    % add a pause of 1 second
    pause(1)
    % clear the previous image from axis
    cla
    % add a pause of 1 second to view the blank axis
    pause(1)
    % display the 2nd image
    imshow('coins.png')