The Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Add Image to Axes in GUI
Replies: 7   Last Post: Feb 13, 2015 11:05 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Jerry Gregoire

Posts: 10
Registered: 3/30/11
Re: Add Image to Axes in GUI
Posted: Feb 12, 2015 2:33 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Here is a routine that will do what you want

function Image(hAxes, imArray)
% Create an image in an axes.

% Delete previous image(s)
delete(get(hAxes, 'children'));

% Flip the image array so it is rightside up and make an image.
hIm = image(flipud(imArray));

% Set image into axis handle, close figure created by image
copyobj(hIm, hAxes);
close gcf

% Adjust the limits so the image fills the axis area
set(hAxes, 'xlim', [1 size(imArray, 2)]);
set(hAxes, 'ylim', [1 size(imArray, 1)]);


> > >
> > > How to get only one radio button checked out of 4-5 on a single gui and how to reset them.
> > >
> > > Thanks
> > > A

>
> It would be nice if this worked but it does not. making the GUI axis current and executing image(imageMatrix), will not put the image into the GUI axis. At least for 2014b. Took some headscratching but this will work:
>
> hImage = image(ImageMatrix)
> copyobj(hImage, handles.YourGuiAxis)
>
> plot accepts a handle as an arguement, plot(handles.YourGuiAxis, x,y). Why image does not is a profound mystery that is only known in the dark reaches of the Mathworks corporate office. Perhaps some day image will be consistent with plot.




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.