Plotting in GUI from an external function using imagesc()

1 vue (au cours des 30 derniers jours)
Darren Miller
Darren Miller le 5 Mai 2020
So I've got an image file loaded in using image = imread(app.ImageName) and I am trying to send it off to an external function to do a fourier transform on it then show it on the gui using imagesc..
How do I use imagesc in a way that might be similar to imshow(img,'parent',app.UIaxes)??
Just to see if I could get something working, I also tried using imshow(img,'parent',app.UIaxes) within this external function to see if I could plot to the gui using that and it is not working either... giving me an error. I need to use imagesc but figured I'd mess around with imshow to see if I could get anything working. Heres whats happening
in GUI:
app.baseImg = imread(app.Input);
imshow(app.baseImg,'Parent',app.UIAxes)
doFourier(app.baseImg,app.RunMode,app.flareAngle,app.stepSize) %calls external function doFourier.m, plugging in the image
in external function, doFourier.m:
imshow(I,'parent',FourierApp.UIAxes2); %I is a modified image of the input image, app.baseImg
and heres the error it is giving me
The property 'UIAxes2' in class 'FourierApp' must be accessed from a class instance because it is not a Constant property.
Error in doFourier (line 5)
imshow(I,'parent',FourierApp.UIAxes2);
EDIT: If I tyoe
FourierApp()
before the imshow() in doFourier it works because it calls the class or something, but then it opens up another instance of the app... I need to call the class somehow at the beginning of the external function so that I can use it to modify things in the FourierApp class.
  8 commentaires
Mohammad Sami
Mohammad Sami le 6 Mai 2020
You can specify the Parent property when calling imagesc
imagesc(C,'Parent',uiax)
Walter Roberson
Walter Roberson le 6 Mai 2020
or for many of the plotting routines you can pass the handle to the container object as the first parameter
imagesc(uiax, C)

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Specifying Target for Graphics Output dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by