Plotting in GUI from an external function using imagesc()
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Mohammad Sami
2020-5-6
You can specify the Parent property when calling imagesc
imagesc(C,'Parent',uiax)
Walter Roberson
2020-5-6
or for many of the plotting routines you can pass the handle to the container object as the first parameter
imagesc(uiax, C)
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!