フィルターのクリア

How can I check a specific axes has an image or not ?

2 ビュー (過去 30 日間)
Ahmer Shahid
Ahmer Shahid 2019 年 1 月 13 日
コメント済み: Ahmer Shahid 2019 年 1 月 13 日
I am using app designer in Matlab 2018a and I replaces a button for testing which is disable.
I know how to enable it but I want to enable it when I have an image on axis.

採用された回答

Kevin Phung
Kevin Phung 2019 年 1 月 13 日
you can get the 'Children' property of the axes.
axes_handle.Children
%or
get(axes_handle,'Children')
  6 件のコメント
Walter Roberson
Walter Roberson 2019 年 1 月 13 日
if ~isempty(findobj(app.UIaxis.Children, 'type', 'flat', 'type', 'image'))
or
any(arrayfun(@(x)isa(x,'matlab.graphics.primitive.Image'),ax.Children))
Ahmer Shahid
Ahmer Shahid 2019 年 1 月 13 日
Thank you very much.

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2019 年 1 月 13 日
What you accepted as the answer is really not the answer as Walter explained. You can use getimage() and check for zero-sized image. Here's a demo:
% Have either plot() or imshow() - comment out one of them.
% Put something into an axes that is NOT an image.
% plot(1:10)
% Put something into an axes that IS an image.
imshow('moon.tif')
% Check what's in the axes.
theImage = getimage();
whos theImage
if size(theImage, 1) ~= 0
msgbox('There is an image in there');
else
msgbox('There is no image in there');
end
  3 件のコメント
Image Analyst
Image Analyst 2019 年 1 月 13 日
You're welcome. You can also than people by clicking the "Vote" link under their icon.
Ahmer Shahid
Ahmer Shahid 2019 年 1 月 13 日
I'm done with it.
Thanks Again.

サインインしてコメントする。

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by