0

I have 5 different filters as 5 different radio buttons in MATLAB GUI. I made them into a button group and now when i click the each button the noise image is shown through the axes. But i want to set the button group in such a way to show only one filter (one image). So, I followed this (How to pass function to radio button in a button group created using guide in MATLAB?) which is given here at stackoverflow. But how do we "set" image in an axes. I have attached the figure of my GUI.enter image description here

Thanks in advance

Community
  • 1
  • 1

1 Answers1

0

You "set" the image in an axes object using the normal plotting commands. Suppose the variable ax holds the handle to the axes object you want to draw on, you could write the following:

axes(ax);      % Select the chosen axes as the current axes
cla;           % Clear the axes
imagesc(im);   % Now draw whatever you want - for example, an image.

Incidentally, in GUIDE you can get usually get the axes handle using the handles argument passed to all callbacks. So for example, if your axes are called axes1, your Button Group callback might look like this:

function uipanel1_SelectionChangeFcn(hObject, eventdata, handles)
    ax = handles.axes1;  % Get handle to axes
    axes(ax);            % Select the chosen axes as the current axes
    cla;                 % Clear the axes
    imagesc(rand(50) );  % Now draw
devrobf
  • 6,973
  • 2
  • 32
  • 46